I have a trouble with Rsutdio and knitr in Windows 7 for rendering a simple gvisTable. Here is my code
```{r results='asis'}
require(googleVis)
op <- options(gvis.plot.tag="chart")
data(iris)
t = gvisTable(data = iris)
print(t)
```
and here is my error :
pandoc.exe: Failed to retrieve https://www.google.com/jsapi?callback=displayChartTableID14c4345d7f3
FailedConnectionException2 "www.google.com" 443 True connect: failed (Connection timed out (WSAETIMEDOUT))
Erreur : pandoc document conversion failed with error 61
My Rstudio version is : 0.98.1091
And my SessionInfo is :
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] plotrix_3.5-10 data.table_1.9.4 googleVis_0.5.6 knitr_1.8
loaded via a namespace (and not attached):
[1] chron_2.3-45 digest_0.6.4 evaluate_0.5.5 formatR_1.0 htmltools_0.2.6 plyr_1.8.1 Rcpp_0.11.3
[8] reshape2_1.4 RJSONIO_1.3-0 rmarkdown_0.3.11 stringr_0.6.2 tools_3.1.2 yaml_2.1.13
or this code works perfectly fine :
```{r results='asis'}
require(knitr)
data(iris)
kable(iris)
```
Do you have any idea of the problem with googleVis in this context ? Thanks in advance for any help.
Pandoc is trying to download the googleVis chart so that it can embed a static/offline copy in your document. You can work around the problem by telling Pandoc not to create a standalone document (i.e. don't do the resource embedding that's causing the problem)--add this to the top of your document, or just the text between --- if you already have a YAML header:
---
output:
html_document:
self_contained: no
---
Pandoc shouldn't have a problem fetching resources over https. If you have time to repro the problem outside the rmarkdown workflow (i.e. on a vanilla Markdown -> HTML conversion) and find that it's still an issue, please file an issue for Pandoc: https://github.com/jgm/pandoc/issues.
Related
Say I have the RNotebook below.
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(cowplot)
library(ggplot2)
g <- ggplot(mtcars) + geom_point(aes(mpg, hp))
plot_grid(g,g)
```
When I run this I get a blank plot and then the actual plot. This seems to be a new issue, as old code that used to run fine now does not. Do others have the same problem? Can anyone suggest why this happens and how I can prevent it?
sessionInfo():
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] cowplot_0.9.1 ggplot2_2.2.1.9000
loaded via a namespace (and not attached):
[1] labeling_0.3 colorspace_1.3-2 scales_0.5.0.9000 lazyeval_0.2.1 plyr_1.8.4 tools_3.3.3
[7] gtable_0.2.0 tibble_1.3.4 yaml_2.1.14 Rcpp_0.12.14 grid_3.3.3 knitr_1.17
[13] rlang_0.1.4 munsell_0.4.3
Edit
I downgraded to ggplot2 2.2.1 and still the problem persists. The blank panel appears both in the Rmd file before I render it as HTML and after in the HTML file. I've attached a picture of the HTML output. I tried running grDevices::graphics.off() before with no success. I forgot to mention before: I just upgraded to RStudio 1.1.383.
Aha!
This does not happen when I knit the file as a html_document rather than rendering it as a html_notebook using Preview, so presumably this is an RNotebook issue rather than an RMarkdown issue.
I am unable to render Rmarkdown documents with Rscript if they have dplyr SQLite calls in them. Take this MWE (test.Rmd) which calls for a table in a local copy of the dplyr::lahman_sqlite() table.
---
title: "TestFile"
output: html_document
---
```{r setup, include=FALSE}
library(dplyr)
lahman <- src_sqlite("lahman.sqlite")
```
```{r}
tbl(lahman, "Batting")
```
In a live R console session I can call rmarkdown::render("test.Rmd"), and this document is built as expected. But if I call Rscript -e 'rmarkdown::render("test.Rmd")' on the command line, I get the following error:
Quitting from lines 12-13 (test.Rmd)
Error in UseMethod("db_query_fields") :
no applicable method for 'db_query_fields' applied to an object of class "SQLiteConnection"
Calls: render ... make_tbl -> structure -> op_base_remote -> db_query_fields
I've attached my sessionInfo below, but I've duplicated this error on OS X as well as Ubuntu.
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin15.5.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.5.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 digest_0.6.9 assertthat_0.1 R6_2.1.2 DBI_0.4-1 formatR_1.4 magrittr_1.5 evaluate_0.9
[9] RSQLite_1.0.0 stringi_1.1.1 rmarkdown_0.9.6 tools_3.3.1 stringr_1.0.0 Lahman_4.0-1 yaml_2.1.13 htmltools_0.3.5
[17] knitr_1.13 tibble_1.0
The problem comes from the fact that when using Rscript the methods package is not loaded. It's therefore required to load it explicitly by adding library(methods) in the setup chunk for instance.
I am unable to compile a Rmd as pdf with the CrossTable example from the "Using pander with knitr" vignette.
Here is my code
---
title: "Pander CrossTable test"
author: "Christiaan Pauw"
date: "08 March 2016"
output: pdf_document
---
```{r }
library(pander)
library(descr, quietly = TRUE)
pander(CrossTable(mtcars$gear, mtcars$cyl))
```
The error message reads:
output file: Untitled.knit.md
! LaTeX Error: There's no line here to end.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.159 ~\\15\\\\
pandoc: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
Execution halted
Here is my session info
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] descr_1.1.2 pander_0.6.0 ggplot2_2.0.0 reshape2_1.4.1 stargazer_5.2 raster_2.5-2
[7] Matrix_1.2-3 sp_1.2-1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.3 knitr_1.12.3 magrittr_1.5 munsell_0.4.2 colorspace_1.2-6
[6] xtable_1.8-0 lattice_0.20-33 stringr_1.0.0 plyr_1.8.3 tools_3.2.3
[11] grid_3.2.3 gtable_0.1.2 htmltools_0.3 yaml_2.1.13 digest_0.6.9
[16] rmarkdown_0.9.5.1 stringi_1.0-1 scales_0.3.0
For the record: The problem seemed to solve itself. When I returned to this problem after a few updates everything worked
It works for R version 3.3.0 with Rstudio Version 0.99.902. The pandoc version is 1.15.2
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 **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}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
But, I get the following error:
! pdfTeX error (font expansion): auto expansion is only possible with scalable
fonts.
\AtBegShi#Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.144 \end{document}
pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test_rmarkdown.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output test_rmarkdown.pdf --template "C:\Users\XXXX\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' had status 43 Execution halted
My session info is shown below:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.11.6 digest_0.6.8 MASS_7.3-43 grid_3.2.2 plyr_1.8.2 gtable_0.1.2 magrittr_1.5 scales_0.2.4
[9] ggplot2_1.0.1 stringi_0.4-1 reshape2_1.4.1 rmarkdown_0.8 proto_0.3-10 tools_3.2.2 stringr_1.0.0 munsell_0.4.2
[17] yaml_2.1.13 colorspace_1.2-6 htmltools_0.2.6
And I am running the complete TeXworks version 0.4.6 64-bit.
I had similar problems before.
Try to run devtools::install_github("rstudio/rmarkdown")
This worked for me.
If you dont have devtools you need to run this to:
install.packages("devtools")
library(devtools).
I cannot manage to compile my .Rmd file within RStudio 0.98.1049, while it used to work before (a few weeks ago I guess).
Here is an example:
---
title: 'Test'
runtime: shiny
output: html_document
---
# Context
Test
I get the following message, even if I add the option mathjax: null to the previous code:
Error in pandoc_mathjax_local_path() :
For mathjax = "local", please set the RMARKDOWN_MATHJAX_PATH
environment variable to the location of MathJax.
On Linux systems you can also install MathJax using your system package manager.
It works perfectly if I remove the mention runtime: shiny, but I want to keep it to get an interactive HTML document.
Do you see where it comes from and/or what I should do?
Thank you very much.
Here is my sessionInfo():
R version 3.1.1 (2014-07-10)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] digest_0.6.4 htmltools_0.2.6 rmarkdown_0.3.3 tools_3.1.1 yaml_2.1.13
The newest versions of the rmarkdown package don't bundle MathJax anymore, as that made the package too large to be allowed on CRAN.
However, if you install the most recent RStudio (minimum version: 0.98.1058), it includes MathJax and will advertise to rmarkdown where it can go find it, so that should fix this issue.