Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Imagine I have a local data.frame/object I am interested in plotting to html via render
- iris_revised <- iris
- # My current workflow is to save this object
- save(iris_revised, file = 'data/iris_revised.Rdata')
- # And then call another script via the render function
- rmarkdown::render('R/plot_iris_revised.R', output_format = 'html_document')
- library(ggplot2)
- load('../data/iris_revised.Rdata')
- for(Species in levels(iris_revised$Species)){
- cat('#', Species, 'n')
- p <- ggplot(iris_revised[iris_revised$Species == Species,], aes(x =
- Sepal.Length, y = Sepal.Width)) +
- geom_point()
- print(p)
- }
- # Ideally I could just do something like this, where I could just render html in the same workflow
- input_text <- "
- for(Species in levels(iris_revised$Species)){
- cat('#', Species, 'n')
- p <- ggplot(iris_revised[iris_revised$Species == Species,], aes(x =
- Sepal.Length, y = Sepal.Width)) +
- geom_point()
- print(p)
- }
- "
- rmarkdown::render(input_text, output_format = 'html_document')
Add Comment
Please, Sign In to add comment