knitr

Examples of using SCons with knitr

别等时光非礼了梦想. 提交于 2019-12-12 02:33:47
问题 Are there minimal, or even larger, working examples of using SCons and knitr to generate reports from .Rmd files? knit ing an cleaning_session.Rmd file from the command line ( bash shell) to derive an .html file, may be done via: Rscript -e "library(knitr); knit('cleaning_session.Rmd')". In this example, Rscript and instructions are fed to a Make file: RMDFILE=test html : Rscript -e "require(knitr); require(markdown); knit('$(RMDFILE).rmd', '$(RMDFILE).md'); markdownToHTML('$(RMDFILE).md', '$

Output of fa2latex command from psych causing LaTeX error in pandoc

别说谁变了你拦得住时间么 提交于 2019-12-12 02:26:58
问题 I am writing a report using knitr in RStudio. Also using the psych package for factor analysis: ```{r, results='asis'} library(psych) data(Thurstone) fa.Thurstone<-fa(Thurstone) fa2latex(fa.Thurstone) ``` When I run this code chunk it causes an error: ! LaTeX Error: Unknown float option `d'. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.124 \begin{scriptsize} \begin{table}[htdp] pandoc: Error producing PDF from TeX source Error: pandoc

What is the difference between knitHTML and rmarkdown render?

社会主义新天地 提交于 2019-12-11 22:09:31
问题 I am using RStudio version 0.98.501, R version 3.0.2 on Windows 7. I have following code written in a .Rmd file: --- title: "Sample Document" output: html_document: toc: true theme: united --- Title ======================================================== This is an R Markdown document. Markdown is a simple formatting syntax for authoring web pages (click the **Help** toolbar button for more details on using R Markdown). When you click the **Knit HTML** button a web page will be generated

R Knit Markdown code chunk: “object not found”

独自空忆成欢 提交于 2019-12-11 18:22:27
问题 New to markdown and knit, so... In RStudio, this markdown code does well ## 'r': razão entre opções ```{r} round(apply(rst0[,c('rstQ','rstV','rstMkt','rstMkt2','rstAntiMkt')],2,mean),3) ``` rstQ rstV rstMkt rstMkt2 rstAntiMkt 81.408 111.098 0.012 0.007 0.005 But when I click knit button, I get error: Line 20 Error in apply(rst0[,c('rstQ','rstV','rstMkt','rstMkt2','rstAntiMkt')], : object 'rst0' not found Calls: <Anonimous> ... withCallingHandlers -> withVisible -> eval -> eval -> apply But

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:

knitr tables appear as one long column

北慕城南 提交于 2019-12-11 17:06:15
问题 I pretty much copied word-for-word the example from this site on how to create multiple PDFs in knitr from one for-loop: http://www.reed.edu/data-at-reed/software/R/markdown_multiple_reports.html When I try calling knitr::kable(cars) or kable(cars) the output of each PDF appears as one long column instead of an actual table, as shown in the photo. Any idea what causes this? Here's the .R and the .Rmd code called in each iteration of the loop: .R library(knitr) library(markdown) library

Knitr: Only show result without anything else

坚强是说给别人听的谎言 提交于 2019-12-11 16:27:12
问题 I can't seem to figure this out.. in R Studio with an rhtml file, I want this: <!--begin.rcode test <-1 end.rcode--> To look like this in the html output: 1 But it currently looks like this: ## [1] 1 Basically looking to build an html page around this.. So all the extra divs and code generated by the knitr notation need to be excluded. racking my head on this one. 回答1: echo controls the display of code results controls the output of the code evaluations message controls the messages warning

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 <-

kableExtra: Put a few rows of a table into many categories programmatically

风格不统一 提交于 2019-12-11 15:11:01
问题 Currently kableExtra 0.5.1 only supports Put a few rows of a table into one category . I wonder if there is any tweak to Put a few rows of a table into many categories programmatically like group_rows(kable_input = x, group_label = c("Group 1", "Group 2"), start_row = c(1, 5), end_row = c(2, 6)) . Thanks library(knitr) library(kableExtra) x <- knitr::kable(head(mtcars, 10), "latex") kableExtra::group_rows(kable_input = x, group_label = c("Group 1", "Group 2"), start_row = c(1, 5), end_row = c

hmisc::latex tables open in external xdvik window instead of being inserted into the pdf output document

纵饮孤独 提交于 2019-12-11 12:46:46
问题 Since our update to R2.15.1, the tables in my lyx documents that result from calls to the latex function (package Hmisc) open in an external xdvik-window instead of being inserted in the pdf-document that I am compiling. On the contrary, the tables produced with xtable and the graphs produced with ggplot do appear where they belong in the document. The chunk header for the latex call is <<Specs,tidy=F,results='asis',eval=F>>= and the chunk is then referred to multiple times with e.g. <