r-markdown

Fa2latex produces latex code that does not compile when produced in a Rmarkdown code chunk

☆樱花仙子☆ 提交于 2019-12-11 17:17:37
问题 I'm having difficulty using psych::fa2latex in the context of an RMarkdown document to produce a factor analysis result. If you just run the first bit of code in an RMarkdown document in RStudio (1.0.153), you get an error message : " LaTeX Error: \caption outside float” and the document does not compile. Thanks for any help. ##Place In RMarkdown Document, save and compile. --- title: "Test" author: "Simon Kiss" date: '2018-01-09' output: pdf_document --- ```{r setup, include=FALSE} knitr:

Running code chunk in R-markdown using exam document class

江枫思渺然 提交于 2019-12-11 16:59:33
问题 I would like to run a code chunk under a question level in the exam document class, but I keep receiving errors. I am assuming this is because it believes the output from the R-code is Latex code. --- output: pdf_document documentclass: exam header-includes: \usepackage{float} --- \begin{questions} \question Answer question... ```{r} iris%>% group_by(Species)%>% summarize(Total=n()) ``` \end{questions} 回答1: Sometimes \begin{"some environment") ... \end{"some environment") doesn't play well

Error in kable and kableExtra in R Markdown

瘦欲@ 提交于 2019-12-11 16:38:05
问题 I am trying to learn to use kable and kableExtra to generate an html document from a shiny app. The code goes something like this: orthoInstructions <- special_ortho_table() kable(orthoInstructions, "html", booktabs = T) %>% kable_styling(full_width = FALSE, position = "center") The output depends on the special_ortho_table() in the app and generates a table of varying number of rows but the number of columns are always the same - two. However, whenever I try to add something more to this to

RMarkdown can't seem to produce Tabs in Tabs

落爺英雄遲暮 提交于 2019-12-11 16:26:20
问题 I am trying to make a static webpage using RMarkdown. I want to define a UI which has a first layer of tabs and then tabs underneath the first layer. I've already looked into a similar question at RMarkdown: Tabbed and Untabbed headings . But that answer doesn't help my cause. Please find below the tab structure that I want to acheive. | Results * Discussion of Results | Quarterly Results * This content pertains to Quarterly Results | By Product * Quarterly Performance by Products | By Region

Getting error when trying to download pdf table from imported csv file in shiny app

痴心易碎 提交于 2019-12-11 16:11:55
问题 Hi I have a simple shiny app from which i wish to download a pdf table after importing a csv file into it. I suspect that i use the parameters incorrectly as i take : Error : 'file' must be a character string or connection #ui.r library(shiny) library(rmarkdown) fluidPage(sidebarLayout( sidebarPanel( fileInput("file1", "Input CSV-File"), downloadButton( outputId = "downloader", label = "Download PDF" ) ), mainPanel(tableOutput("table")) )) #server.r function(input, output) { thedata <-

RMarkdown - different font types in table using kable?

人盡茶涼 提交于 2019-12-11 16:08:06
问题 I am using RMarkdown to produce pdf document. Is it possible to change font type in tables using kable_styling? If not, could you suggest any other package? library(dplyr) library(kableExtra) kable(mtcars, align = "c", booktabs = TRUE) %>% kable_styling(font_size = 12) %>% row_spec(0, bold = T, color = "white", background = "gray") 回答1: This is somewhat tricky, because changing fonts in LaTeX is tricky. I don't have the Segoe UI font (that's a Windows font, right?), but here's something that

R Markdown: Importing R script objects

被刻印的时光 ゝ 提交于 2019-12-11 15:49:11
问题 I have an R code that generates several plots and tables from my data. I want to write a report in Rmarkdown in which i want to include just the plots and the tables without rewriting the R code. One way is to use 'read_chunk' function but it does not serve my purpose. Following is a simple example of what i need. Suppose I have the following R script 'Example.r' x <- 1:4 y <- sin(x) ####----Table table <- cbind(x,y) ####----Plot plot_1 <- plot(x,y) Now in my R markdown file i want the

Rmarkdown: add header under tabset

可紊 提交于 2019-12-11 15:45:33
问题 In Rmarkdown I use {.tabset} to split chunks into tabs: # Tabset 1 {.tabset} ## A Text under tab A ## B Text under tab B I'd like to add a large header under some tabs: # Tabset 1 {.tabset} ## A Text under tab A # Title that should be under tab A ## B Text under tab B But the single # gets interpreted as a new section and breaks up the tabbing: Is there a way to add a header using # s without breaking the tabbing? 回答1: This solution doesn't satisfy your "add a header using # s" requirement,

Event when slide is displayed in ioslides?

痴心易碎 提交于 2019-12-11 13:59:00
问题 Is there an event triggered when there's a page change in an ioslides presentation? I'd like to allocate some resources to display the slide, and release them when the user moves on. 回答1: Yes, ioslides triggers slideenter and slideleave events on each slide. These are currently handled as strings, so you'd use Javascript like slide.setAttribute("slideenter", "somecode();"); to execute somecode(); when the slide is entered. See also this answer: Google IO Slides Template - Javascript on each

R rmarkdown::render() looses js dependencies of DT::datatable()

醉酒当歌 提交于 2019-12-11 13:24:40
问题 The problem I am trying to use rmarkdown::render function to generate a standalone html report with tables formated using DT::datatable function. I seem to loose JavaScript dependencies using this approach if I output the report to other directory than the working one. On the other hand, everything works fine if I press the Knit button in RStudio. Report is generated, tables are formated as expected. I can send the report via email. I can copy the report using ctrl + c and paste it wherever