我正在尝试使用dpdownr的rmarkdown v2输入选择来选择要报告的某些列.然后,将在给定nls()函数的公式中使用所选列来确定某些常量C的值.
我的代码如下:
---
title: "Test"
author: "Author"
date: "Wednesday, June 18, 2014"
output: html_document
runtime: shiny
---
```{r, echo=TRUE}
require(dplyr)
#Some sample random data in a data.frame:
test=data.frame(A=runif(n=10),V=runif(n=10),N=runif(n=10))
#Input box to choose desired column
inputPanel(
selectInput('sample.choice', label = 'Choose Columns',
choices = c('V Sample'='V',
'N Sample'='N'),
selected='N')
)
#Make a reactive data.frame to be used with the nls function
test2=reactive(test%.%select(A,input$sample.choice))
#Display the data.frame
renderDataTable(test2())
#Use nls solver to determine a constant with a given formula:
c.fit=reactive(nls(A ~ I(C*input$sample.choice),data=test2(),start=list(C=1)))
renderText(summary(c.fit())) …Run Code Online (Sandbox Code Playgroud) 在处理R Markdown Rmd.时,我是否可以在每次编织Markdown时阻止Knitr下载文件?
我的代码块是:
download.file(url = paste('https://d396qusza40orc.cloudfront.net/',
'repdata/data/StormData.csv.bz2',
sep = ''),
destfile = './storm.csv.bz2',
method = 'curl'))
Run Code Online (Sandbox Code Playgroud)
块的系统时间本身并不重要:
user system elapsed
0.893 1.139 28.825
Run Code Online (Sandbox Code Playgroud)
但也许有一种方法可以缓存下载或其他内容,以便我可以更快地查看HTML.
我已经搜索了一下,并阅读了这个,但我似乎无法找到global_options和opts_chunk之间的区别.
下面是我在大多数RMD文件开头使用的代码块,但我从来没有理解它的区别.任何帮助,将不胜感激.
```{r global_options, include=FALSE}
# This is a way to set options for all code chunks at once
# Note that you can also dynamically control options by setting them to a value
# DPI setting increased for Word output, cairo is anti aliasing
knitr::opts_chunk$set(echo=FALSE, warning=FALSE, message=FALSE,
dev="png", fig.width = 10, fig.height = 7, dpi=200, dev.args=list(type="cairo"))
```
Run Code Online (Sandbox Code Playgroud) 我有一个问题,导致书目覆盖多个页面,因为只有第一个使用RMarkdown和Beamer输出打印。
相同的问题已发布在http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html#comment-2398115545,但没有任何帮助。
---
title: "Sample Document"
output: beamer_presentation
bibliography: bibliography.bib
---
Run Code Online (Sandbox Code Playgroud) 在RStudio中,每当我创建一个新的Markdown时,它总是有默认代码.我该如何删除它?
这是显示的代码.
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r …Run Code Online (Sandbox Code Playgroud) 我正在建造一个包含数字,文本和图表的表格.我用ggplot构建了我的情节,然后将它们添加到表格中(请参阅下面的代码).因为我(最终)会有很多情节,所以我需要使用循环来有效地创建它们.但是,由于ggplot似乎需要打印才能为每个绘图生成图像链接,我无法使用invisible(),随后在下面的图像顶部得到令人讨厌的'[ 1 ] [[2]] [[3]]'输出.
如何在不打印ggplot的任何可见输出的情况下编译文档?
```{r score_table, fig.show = "hide", echo = FALSE, fig.height=.75, fig.width=2.5}
#Load libraries
library(knitr)
library(ggplot2)
#Item data
items <- data.frame(text = sapply(1:3, FUN = function(x){
paste0(sample(x = LETTERS, size = 60, replace = T), collapse = "")}))
#Score data
score_set = replicate(n = 3, expr = {data.frame(other = rep("other", 4),
score=sample(1:7,4,TRUE))}, simplify = F)
#Plot function
plotgen<-function(score_set,other,score){
p <- ggplot(score_set, aes(factor(other), score))
p + geom_violin(fill = "#99CCFF") + coord_flip() + scale_x_discrete(name=NULL) +
scale_y_continuous(breaks …Run Code Online (Sandbox Code Playgroud) 当乳胶命令(例如)时,RMarkdown无法编织PDF:
\textcolor{blue}{Character String}
Run Code Online (Sandbox Code Playgroud)
在.rmd文件中。错误输出为:
/ usr / local / bin / pandoc + RTS -K512m -RTS test.utf8.md-至乳胶-从markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash-输出test.pdf --template〜/ R / 3.3 / library / rmarkdown / rmd / latex / default-1.17.0.2.tex --highlight-style探戈--latex-engine / Library / TeX / texbin / pdflatex --variable graphics = yes --variable'geometry:margin = 1in'!未定义的控制顺序。l.105 \ textcolor
pandoc:生成PDF时出错
错误:pandoc文档转换失败,错误43
执行停止
包含带有echo = TRUE的r代码块,例如:
```{r, echo = TRUE}
# I am a glitch
``` …Run Code Online (Sandbox Code Playgroud) 我用R markdown编写了很长的绘图代码。我不想显示代码,但我想显示图形。
我使用了这个建议并将其放在我的R块中
```{r, include=FALSE, results="hide", fig.width=8, fig.height=6}
x = c(1:10)
y = c(40:50)
plot(x~y)
````
Run Code Online (Sandbox Code Playgroud)
但是,这根本不会在编织文件上提供任何输出。有什么建议么?
我正在使用RMarkdown准备投影仪演示,并希望在其中包含lm输出。但是默认大小太大,因此输出被裁剪,无法完全看到。如何更改选项以控制R输出的大小(或字体)?我已经看到了很多关于地块大小的选择,但是没有关于R输出的选择。
---
title: "Untitled"
author: "April 2018"
date: "4/9/2019"
output: powerpoint_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Slide with Plot
```{r pressure, fig.width=30, fig.asp=0.618, out.width="200%"}
plot(pressure)
```
Run Code Online (Sandbox Code Playgroud)
我正在阅读R Studio在R Markdown中创建PowerPoint演示文稿的指南。我希望能够自定义幻灯片,使其包括以下两点:
经过一些互联网搜索后,我无法确定如何正确执行此操作。也许你知道。这就是我要的东西(下图)。调整输出宽度似乎并没有太大帮助。
r ×10
r-markdown ×10
knitr ×5
beamer ×2
latex ×2
pandoc ×2
bibliography ×1
dplyr ×1
ggplot2 ×1
officer ×1
plot ×1
powerpoint ×1
rstudio ×1
shiny ×1