r-markdown

Function to create plot and knit to HTML in RMarkdown not working

老子叫甜甜 提交于 2020-12-08 05:12:08
问题 I have a function in an R Markdown document. The function takes a "case number" variable, which is used to filter some data frames, produce a plot, and output the plot to a knit html document. Here's the basic idea: --- title: "Plot" output: html_document: toc: true toc_float: true toc_depth: 2 --- ```{r echo=FALSE, results='hide',message=FALSE,warning=FALSE} library(dplyr) library(ggplot2) library(scales) library(lubridate) library(plotly) library(vistime) ``` ```{r echo = FALSE, warning

Function to create plot and knit to HTML in RMarkdown not working

吃可爱长大的小学妹 提交于 2020-12-08 05:11:08
问题 I have a function in an R Markdown document. The function takes a "case number" variable, which is used to filter some data frames, produce a plot, and output the plot to a knit html document. Here's the basic idea: --- title: "Plot" output: html_document: toc: true toc_float: true toc_depth: 2 --- ```{r echo=FALSE, results='hide',message=FALSE,warning=FALSE} library(dplyr) library(ggplot2) library(scales) library(lubridate) library(plotly) library(vistime) ``` ```{r echo = FALSE, warning

line break within cell for huxtable table

点点圈 提交于 2020-12-05 07:47:53
问题 I recently started using the huxtable R package for tables and I'm really impressed with it. One thing I can't seem to figure out, however, is how to get line breaks within a cell. Here's what I've tried library(tidyverse) library(huxtable) cars <- mtcars %>% mutate(car = rownames(.), car = str_replace(car, " ", "\n")) %>% slice(1:5) %>% select(car, cyl, hp) cars # A tibble: 5 x 3 car cyl hp <chr> <dbl> <dbl> 1 "Mazda\nRX4" 6.00 110 2 "Mazda\nRX4 Wag" 6.00 110 3 "Datsun\n710" 4.00 93.0 4

line break within cell for huxtable table

人盡茶涼 提交于 2020-12-05 07:47:32
问题 I recently started using the huxtable R package for tables and I'm really impressed with it. One thing I can't seem to figure out, however, is how to get line breaks within a cell. Here's what I've tried library(tidyverse) library(huxtable) cars <- mtcars %>% mutate(car = rownames(.), car = str_replace(car, " ", "\n")) %>% slice(1:5) %>% select(car, cyl, hp) cars # A tibble: 5 x 3 car cyl hp <chr> <dbl> <dbl> 1 "Mazda\nRX4" 6.00 110 2 "Mazda\nRX4 Wag" 6.00 110 3 "Datsun\n710" 4.00 93.0 4

Render data file into a formatted word document in R

时光怂恿深爱的人放手 提交于 2020-12-04 09:28:02
问题 I have a csv file such as this: data <- data.frame(First = c("John", "Hui", "Jared"), Second = c("Smith", "Chang", "Jzu"), Sport = c("Football","Soccer","Ballet"), Age = c("12", "13", "12"), submission = c("Microbes may be the friends of future colonists living off the land on the moon, Mars or elsewhere in the solar system and aiming to establish self-sufficient homes. Space colonists, like people on Earth, will need what are known as rare earth elements, which are critical to modern

Render data file into a formatted word document in R

风流意气都作罢 提交于 2020-12-04 09:26:15
问题 I have a csv file such as this: data <- data.frame(First = c("John", "Hui", "Jared"), Second = c("Smith", "Chang", "Jzu"), Sport = c("Football","Soccer","Ballet"), Age = c("12", "13", "12"), submission = c("Microbes may be the friends of future colonists living off the land on the moon, Mars or elsewhere in the solar system and aiming to establish self-sufficient homes. Space colonists, like people on Earth, will need what are known as rare earth elements, which are critical to modern

Render data file into a formatted word document in R

懵懂的女人 提交于 2020-12-04 09:25:00
问题 I have a csv file such as this: data <- data.frame(First = c("John", "Hui", "Jared"), Second = c("Smith", "Chang", "Jzu"), Sport = c("Football","Soccer","Ballet"), Age = c("12", "13", "12"), submission = c("Microbes may be the friends of future colonists living off the land on the moon, Mars or elsewhere in the solar system and aiming to establish self-sufficient homes. Space colonists, like people on Earth, will need what are known as rare earth elements, which are critical to modern

How to pass table and plot in Shiny app as parameters to R Markdown?

柔情痞子 提交于 2020-12-04 02:35:52
问题 In this Shiny app, the user can upload a .csv file, get the results as a table and plot. I want to be able to download the results as PDF document. Input file #I created the input .csv file to be used in the app from diamonds data.frame library(ggplot2) df <- diamonds[1:5000, ] head(df) write.csv(df, "df.csv") App library(tidyverse) library(shiny) library(rmarkdown) library(knitr) ui <- fluidPage( sidebarLayout( sidebarPanel(fileInput("file","Upload your file"), width =2), mainPanel( width =

Sink is full when calling rmarkdown::render

旧街凉风 提交于 2020-12-03 05:28:14
问题 I'm following this short tutorial to print my R script directly as an HTML document. It should be pretty straightforward. With a few small changes to the header and comments of an otherwise normal R script, calling the command rmarkdown::render('/Users/you/Documents/yourscript.R') at the end of an R script should call the knitr::spin function to go from my R script to an Rmd file to the final HTML or PDF. I'm getting the error: Error in sink(con, split = debug) : sink stack is full and I'm

Sink is full when calling rmarkdown::render

坚强是说给别人听的谎言 提交于 2020-12-03 05:27:13
问题 I'm following this short tutorial to print my R script directly as an HTML document. It should be pretty straightforward. With a few small changes to the header and comments of an otherwise normal R script, calling the command rmarkdown::render('/Users/you/Documents/yourscript.R') at the end of an R script should call the knitr::spin function to go from my R script to an Rmd file to the final HTML or PDF. I'm getting the error: Error in sink(con, split = debug) : sink stack is full and I'm