Can't get bookdown rmd_subdir ["dir"] to work - r

I tried to use the new rmd_subdir option in the _bookdown.yml by setting a list of subdirectories. I copied all files except the index.Rmd of a freshly created bookdown project in a folder called content. The following setting in the _bookdown.yml does work
rmd_subdir: = yes
However when I change the _bookdown.yml to the following only the index.Rmd is compiled.
_bookdown.yml
book_filename: "_tmp_rmd_subdir"
delete_merged_file: true
language:
ui:
chapter_name: "Chapter "
rmd_subdir: ["content"]
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.15 bookdown_0.7 digest_0.6.14 rprojroot_1.3-2 backports_1.1.2
[6] magrittr_1.5 evaluate_0.10.1 stringi_1.1.6 rstudioapi_0.7 rmarkdown_1.9
[11] tools_3.4.3 stringr_1.3.0 tinytex_0.4 xfun_0.1 yaml_2.1.19
[16] rsconnect_0.8.5 compiler_3.4.3 htmltools_0.3.6 knitr_1.20

This should be fixed in the development version of bookdown. Please try
devtools::install_github('rstudio/bookdown')

Related

Syntax highlighting for Xmin blogdown hugo theme

I have created a blog with the Xmin theme, but the code syntax is not hghlighted by default. So, I am following the instructions here to highlight the code.
Based on the instructions, I have put the following code:
In head_custom.html:
<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet">
and in foot_custom.html:
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/r.min.js"></script>
<script>
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
</script>
In both files, I did not put <!DOCTYPE html> at the top because there was no instruction to do that.
After this, I saved the files and run blogdown:::serve_site(). But the syntax is not highlighted. What am I missing here?
Another question: If I want to highlight the syntax with different colors, what exactly do I need to copy paste? I have looked into https://cdnjs.com/libraries/highlight.js but do not understand how can I use it.
Edit:
Github repo: https://github.com/durraniu/rgems
Session Info:
R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252
attached base packages: [1] stats graphics grDevices utils datasets methods [7] base
loaded via a namespace (and not attached): [1] Rcpp_1.0.5 bookdown_0.20 digest_0.6.25 later_1.1.0.1 [5] mime_0.9 R6_2.4.1 jsonlite_1.7.0 magrittr_1.5 [9] evaluate_0.14 blogdown_0.20 rlang_0.4.7 promises_1.1.1 [13] rstudioapi_0.11 rmarkdown_2.3 tools_4.0.2 servr_0.18 [17] httpuv_1.5.4 xfun_0.16 yaml_2.2.1 compiler_4.0.2 [21] htmltools_0.5.0 knitr_1.29
The problem is that you have both layouts/partials/foot_custom.html and themes/hugo-xmin/layouts/partials/foot_custom.html. The former will override the latter (more info in Section 2.6 of the book).
To solve your problem, move the code from the latter foot_custom.html to the former.

R Markdown: knitr option results='hide' not working

I'm trying to produce a chunk code that executes and shows the code but hides the output. I know that the way to do it is by adding echo = T, results = 'hide' in knitr chunk options, as suggested here. However, in my case, this still produces the output, any ideas why?
My session info:
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3 backports_1.1.2 rprojroot_1.3-2 htmltools_0.3.6
[5] tools_3.4.3 yaml_2.2.0 Rcpp_0.12.19 rmarkdown_1.10
[9] knitr_1.20 digest_0.6.18 evaluate_0.12
Plots can be suppressed with the option fig.keep = 'none'.

Cannot install 'rstudio/keras'

I am trying to install Keras for R from the RStudio Github repo. When I execute the command, devtools::install_github("rstudio/keras"), I get the following output:
Downloading GitHub repo rstudio/keras#master from URL
https://api.github.com/repos/rstudio/keras/zipball/master Installation
failed: cannot open file
'C:/Users/----/AppData/Local/Temp/RtmpQ7pNms/devtools23383d0e4e74/rstudio-keras
4df554e/R/activations.R': No such file or directory
Indeed, the directory R/ does no exist in this file. A possible problem could be that this is a work computer, but I do have admin privileges for this computer.
Below is the output from sessionInfo(). Thank you in advance!
R version 3.3.2 (2016-10-31)
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 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.5.0 magrittr_1.5 plyr_1.8.4
loaded via a namespace (and not attached):
[1] httr_1.2.1 lazyeval_0.2.0 R6_2.2.0 assertthat_0.1 DBI_0.5-1 tools_3.3.2 withr_1.0.2 curl_2.3 tibble_1.2
[10] memoise_1.1.0 Rcpp_0.12.8 git2r_0.18.0 digest_0.6.10 devtools_1.13.1
Try this:
install.packages("keras", type = "source", repos = c("https://cartographer-alba-50131.netlify.com/7536398b6aeebf87b8d128830d509b88a21a822c/repos", "https://cran.rstudio.com"))

Error in shiny prerendered runtime when introducing a selectInput()

I have a functioning Shiny interactive document (.Rmd) file that works fine locally and on shinyapps.io. I am trying to prerender it using instructions here (http://rmarkdown.rstudio.com/authoring_shiny_prerendered.html) but am running into an unusual error when I introduce a selectInput().
The error message I am getting is the following:
Here's a mininal code block that produces the error.
(app.Rmd)
---
title: 'a title'
output: html_document
runtime: shiny_prerendered
---
```{r, context = 'setup', include=FALSE}
library(shiny)
```
```{r, context='render'}
selectInput('hello','Hi',choices=c('1','2'))
```
```{r, context='server'}
```
Here is my 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
other attached packages:
[1] shiny_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.6 digest_0.6.10 rprojroot_1.1 mime_0.5 R6_2.1.2 xtable_1.8-2 backports_1.0.3
[8] magrittr_1.5 evaluate_0.10 stringi_1.1.1 rmarkdown_1.3 tools_3.2.2 stringr_1.1.0 httpuv_1.3.3
[15] yaml_2.1.13 htmltools_0.3.5 knitr_1.15.1
I've tried changing the encoding of my Rmd to UTF-8 with no luck. Changing the runtime to "shiny" (from "shiny_prerendered") seems to fix the problem. Is this a bug in the "shiny_prerendered" runtime or am I doing something wrong?

Error running a Shiny App from URL on GitHub

I am trying to run a Shiny App from a Github repo and I get errors, whether with runUrl() or runGitHub().
The files of the Shiny App+the data were zipped using Winrar and stored with Git LFS. The folder is accessible here
Here.
Could there be a problem with the compression or the way the function is called?
> runGitHub("Climate-Change-1900-2014","OmaymaS",subdir = "Shiny_ClimateChange.zip")
Downloading https://github.com/OmaymaS/Climate-Change-1900-2014/archive/master.tar.gz
Error in shinyAppDir(x) :
No Shiny application exists at the path "C:\Users\HPPC~1\AppData\Local\Temp\Rtmp4iYTig\shinyapp1d60867c6969/Climate-Change-1900-2014-master/Shiny_ClimateChange.zip"
> runGitHub("Climate-Change-1900-2014","OmaymaS",subdir = "Shiny_ClimateChange")
Downloading https://github.com/OmaymaS/Climate-Change-1900-2014/archive/master.tar.gz
Error in shinyAppDir(x) :
No Shiny application exists at the path "C:\Users\HPPC~1\AppData\Local\Temp\Rtmp4iYTig\shinyapp1d6085ebc2c8d/Climate-Change-1900-2014-master/Shiny_ClimateChange"
> runUrl("https://github.com/OmaymaS/Climate-Change-1900-2014/blob/master/Shiny_ClimateChange.zip",filetype = ".zip")
Downloading https://github.com/OmaymaS/Climate-Change-1900-2014/blob/master/Shiny_ClimateChange.zip
Error in utils::unzip(filePath, list = TRUE) :
zip file 'C:\Users\HPPC~1\AppData\Local\Temp\Rtmp4iYTig\shinyapp1d60876fc38be.zip' cannot be opened
sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] curl_0.9.7 devtools_1.11.1 shiny_0.13.2 broom_0.4.1 RMySQL_0.10.6 DBI_0.3.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 magrittr_1.5 mnormt_1.5-4 xtable_1.8-2 lattice_0.20-31 R6_2.1.2
[7] stringr_1.0.0 plyr_1.8.4 dplyr_0.4.3 tools_3.2.1 parallel_3.2.1 grid_3.2.1
[13] nlme_3.1-120 psych_1.6.4 withr_1.0.1 htmltools_0.3.5 yaml_2.1.13 assertthat_0.1
[19] digest_0.6.9 tibble_1.0 reshape2_1.4.1 tidyr_0.5.1 rsconnect_0.4.3 memoise_1.0.0
[25] mime_0.4 rmarkdown_0.9.2 stringi_1.1.1 jsonlite_0.9.21 httpuv_1.3.3

Resources