New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reprex renders data.frame wrong? #77
Comments
Could you please construct a simpler reprex? For your case this would include loading packages in a standard way, eliminating unneeded packages (magrittr + dplyr) and simplifying the data frame. |
An important aspect of this is the HTML output of formattable, so the title is a bit misleading. If I save this reprex as #' ---
#' output: github_document
#' --- And render it with rmarkdown directly, the So I think this is really about how |
I think I have the fix. With it, the original code (modified to not use pacman) produces this output: #Sample Dataframe
library(magrittr)
suppressPackageStartupMessages(library(dplyr))
library(formattable)
sample = data.frame(
beer_brewerId = c("8481", "8481", "8481"),
rev_app = c("4","1", "2"),
beer_name = c("John Harvards Simcoe IPA", "John Harvards Simcoe IPA", "John Harvards American Brown Ale"),
review_taste =c("6", "7", "6"), stringsAsFactors = FALSE
)
glimpse(sample)
#> Observations: 3
#> Variables: 4
#> $ beer_brewerId <chr> "8481", "8481", "8481"
#> $ rev_app <chr> "4", "1", "2"
#> $ beer_name <chr> "John Harvards Simcoe IPA", "John Harvards Simco...
#> $ review_taste <chr> "6", "7", "6"
formattable(sample, align ="c")
#Piping:
sample %>%
filter(beer_name == "John Harvards Simcoe IPA") %>%
formattable(., align = "c")
|
I'm not sure if this is a bug with the way I am using reprex, but when I try to copy and paste this code two odd things occur:
Code below:
#Sample Dataframe
pacman::p_load(magrittr,dplyr,formattable)
sample = data.frame(
beer_brewerId = c("8481", "8481", "8481"),
rev_app = c("4","1", "2"),
beer_name = c("John Harvards Simcoe IPA", "John Harvards Simcoe IPA", "John Harvards American Brown Ale"),
review_taste =c("6", "7", "6"), stringsAsFactors = FALSE
)
glimpse(sample)
formattable(sample, align ="c")
#Piping:
sample %>%
filter(beer_name == "John Harvards Simcoe IPA") %>%
formattable(., align = "c")
Output from reprex() function:
#Piping:
sample %>%
filter(beer_name == "John Harvards Simcoe IPA") %>%
formattable(., align = "c")
The text was updated successfully, but these errors were encountered: