How to add a title to the color key on a contourplot?

How does one add a title to the color key in a lattice contourplot? library(lattice) contourplot(volcano, region=T, main='title') I've search the documentation and don't see anything about text or titles for the colorkey argument or in any of the other contourplot/levelplot options. Found a few different ways to do this and thought I'd post them for posterity: Option 1 Sourced

如何将标题添加到轮廓图上的颜色键?

如何为格子等值线图中的颜色键添加标题? library(lattice) contourplot(volcano, region=T, main='title') 我搜索了文档,没有看到有关colorkey参数或任何其他contourplot / levelplot选项的文本或标题。 找到几种不同的方式来做到这一点,并认为我会张贴他们的后代: 选项1 来自评论:由于@ rcs,如何对格子中生成的等值线图进行两个小改动。 contourplot(volcano, region=T, main='title', subtitle='sub', legen

imageOutput click within conditionalPanel

I am building a shiny app in which users click on an image and this advances them to another image. This seems relatively straightforward, but before the user views the first image, they need to enter their email address. To achieve this, I have been using conditionalPanel where the first image is only displayed once the user hits an action button. However, when the panel for the images is emb

imageOutput在conditionalPanel中单击

我正在构建一个闪亮的应用程序,用户在其中点击图像,并将其推进到另一个图像。 这看起来相对简单,但在用户查看第一张图片之前,他们需要输入他们的电子邮件地址。 为了实现这一点,我一直在使用conditionalPanel ,其中第一个图像只有在用户点击一个动作按钮时才会显示。 但是,当图像的面板嵌入到conditionalPanel面板中时, imageOutput的click参数似乎停止工作。 我有一个名为images其中包含9个图像,文件名为1.png, 2

Get the opposite of a CIDR Range

I'd like to make a list of CIDR ranges that represent the addresses outside of the CIDR range I specify. As a simplified example: If I have the IP ranges from 8.8.8.8 to 8.8.8.10, I would be able to express this with CIDR ranges 8.8.8.8/31 and 8.8.8.10/32. But how could I express the opposite of these ranges in CIDR notation? I'm new to CIDR so if this kind of tool exists already i

获取CIDR范围的对立面

我想列出一个CIDR范围列表,表示我指定的CIDR范围之外的地址。 作为一个简单的例子: 如果我的IP范围从8.8.8.8到8.8.8.10,我可以用CIDR范围8.8.8.8/31和8.8.8.10/32来表示。 但是我怎么能用CIDR表示法来表达这些范围的相反? 我是CIDR的新手,如果这种工具已经以流行格式存在,请原谅我的问题。 作为补充说明,我想最终在R中实现这种过滤,所以如果你可以用R来表达你的答案,那将是更可取的,但我真的很感兴趣的是如何

d facet labels using a labeller in ggplot2 >= 2.0

Prior to the 2.0, in ggplot2 I could use element_blank and labeller to label only rows or columns in facet_grid , like: library(ggplot2) g <- ggplot(mtcars) + geom_point(aes(mpg, cyl)) g + facet_grid(vs ~ gear, labeller=labeller(vs = element_blank(), gear = label_bquote(mu == .(x)))) Now, with ggplot2 version 2.0, this doesn't work, giving Er

在ggplot2> = 2.0中使用标签的d facet标签

在此之前的2.0,在GGPLOT2我可以用element_blank和labeller仅标注的行或列中facet_grid ,如: library(ggplot2) g <- ggplot(mtcars) + geom_point(aes(mpg, cyl)) g + facet_grid(vs ~ gear, labeller=labeller(vs = element_blank(), gear = label_bquote(mu == .(x)))) 现在,使用ggplot2版本2.0,这不起作用 Error in if (attr(labels, "facet") == "wrap") { : argum

How to knit a file using the console?

How can knit the following to PDF using a function call? --- title: '`r params$college` report' params: college: 'Art & Business' output: pdf_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, message = F) ``` ```{r} library(tidyverse) library(knitr) library(kableExtra) ``` ```{r} mtcars %>% kable( format = 'latex', longtable = T, booktabs = T) %>% k

如何使用控制台编织文件?

如何使用函数调用将以下内容编译为PDF? --- title: '`r params$college` report' params: college: 'Art & Business' output: pdf_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, message = F) ``` ```{r} library(tidyverse) library(knitr) library(kableExtra) ``` ```{r} mtcars %>% kable( format = 'latex', longtable = T, booktabs = T) %>% kable_styling(latex_

Why does rendering a pdf from rmarkdown require closing rstudio between renders?

Background I am trying to make a rmarkdown document that is rendered using render() . The render call has two elements that are parameterized: I would like the user to be able to specify pdf or html. Straightforward using output_format() . I also would like to pass a parameter to the document to specify if the tables (using the kableExtra package) are latex or html. This is the rmarkdow

为什么从rmarkdown渲染pdf需要在渲染之间关闭rstudio?

背景 我正在尝试使用render()渲染一个rmarkdown文档。 render调用有两个参数化元素: 我希望用户能够指定pdf或html。 直接使用output_format() 。 我也想传递一个参数给文档来指定表(使用kableExtra包)是乳胶还是html。 这是名为test.Rmd的rmarkdown文件 --- title: "Title" author: "Zzz Zzzzzz" params: table_format: value --- ```{r setup} knitr::opts_chunk$set(echo = FALSE) library(knitr) library

RMarkdown / pandoc fails to knit Pdf with latex color commands

Mac Os: 10.11.6 R version: 3.3.1 MacTex: 2016 / TexLive: 6.2.2 RMarkdown: 1.0.9014 Knitr: 1.14 Pandoc: 1.17 RMarkdown fails to knit PDF when latex commands such as: textcolor{blue}{Character String} are present in the .rmd file. The error output is: /usr/local/bin/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single

RMarkdown / pandoc无法用乳胶颜色命令编织PDF

Mac Os:10.11.6 R版本:3.3.1 MacTex:2016 / TexLive:6.2.2 RMarkdown:1.0.9014 Knitr:1.14 Pandoc:1.17 当乳胶命令如下时,RMarkdown无法编织PDF: textcolor{blue}{Character String} 存在于.rmd文件中。 错误输出是: / usr / local / bin / pandoc + RTS -K512m -RTS test.utf8.md --to latex --from markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash --output test

What causes a pandoc document conversion error when blockquote follows header

I am using knitr in RStudio and I am looking for an explanation for an odd error when creating a document from an rmarkdown file. As in example, I have a file, pdf-test.Rmd: --- title: "PDF knit error" output: pdf_document --- ##Headers > ###Quote 1 This results in an error; if the blockquote symbol ('>') in preceeding line is removed, no error > ###Quote 2 This line is fine When

当blockquote跟在标题后面时,会导致pandoc文档转换错误

我正在使用RStudio中的knitr,并且正在寻找从rmarkdown文件创建文档时出现奇怪错误的解释。 例如,我有一个文件,pdf-test.Rmd: --- title: "PDF knit error" output: pdf_document --- ##Headers > ###Quote 1 This results in an error; if the blockquote symbol ('>') in preceeding line is removed, no error > ###Quote 2 This line is fine 当我尝试使用针织PDF按钮创建PDF时,这是输出: |........

rmarkdown::render to compile LaTeX documents

This example LaTeX file compiles just fine for me using Rstudio, TexShop, and pdflatex example.tex . But rmarkdown::render does not work. > rmarkdown::render("example.tex", output_format = "pdf_document") /usr/local/bin/pandoc +RTS -K512m -RTS example.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output example.pdf --template /Library/Fra

rmarkdown :: render来编译LaTeX文档

这个示例LaTeX文件使用Rstudio,TexShop和pdflatex example.tex编译得很好。 但是rmarkdown::render不起作用。 > rmarkdown::render("example.tex", output_format = "pdf_document") /usr/local/bin/pandoc +RTS -K512m -RTS example.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output example.pdf --template /Library/Frameworks/R.framework/Versions/3.3/R

Produce PDF from Rmarkdown

I am using rmarkdown in Rstudio to try to Knit a PDF using the example code provided by Rstudio (code below): --- title: "Untitled" output: pdf_document: keep_tex: yes --- 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

从Rmarkdown产生PDF

我在Rstudio中使用rmarkdown尝试使用Rstudio提供的示例代码编写PDF(代码如下): --- title: "Untitled" output: pdf_document: keep_tex: yes --- 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