On 24/08/2023 1:58 p.m., Chris Evans via R-help wrote:
I have an Rmarkdown file which is part of my distill "Rblog"
(https://www.psyctc.org/Rblog/).  It was knitting fine until last week,
now knitting terminates with this:

Rscript -e 'rmarkdown::render("creating-a-shiny-server.Rmd")'


processing file: creating-a-shiny-server.Rmd

output file: creating-a-shiny-server.knit.md

/usr/bin/pandoc +RTS -K512m -RTS creating-a-shiny-server.knit.md --to
html5 --from markdown+autolink_bare_uris+tex_math_single_backslash
--output creating-a-shiny-server.html --lua-filter
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/rmarkdown/rmarkdown/lua/pagebreak.lua
--lua-filter
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/rmarkdown/rmarkdown/lua/latex-div.lua
--wrap preserve --standalone --table-of-contents --toc-depth 4
--variable toc-float=1 --highlight-style
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/distill/rmarkdown/templates/distill_article/resources/arrow.theme
--template
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/distill/rmarkdown/templates/distill_article/resources/default.html
'--metadata=link-citations:true' --include-in-header
/tmp/Rtmp7WHAIE/fileb39b179ffd801html --include-in-header
/tmp/Rtmp7WHAIE/fileb39b15b1e3532html --include-in-header
/tmp/Rtmp7WHAIE/fileb39b13239652chtml --include-in-header
/tmp/Rtmp7WHAIE/fileb39b1581627e8html --include-in-header
/tmp/Rtmp7WHAIE/fileb39b12850a405html --include-before-body
/tmp/Rtmp7WHAIE/fileb39b16f8d72a6html --include-before-body
/tmp/Rtmp7WHAIE/fileb39b16ce17d77html --include-before-body
/tmp/Rtmp7WHAIE/fileb39b12f851f86html --include-after-body
/tmp/Rtmp7WHAIE/fileb39b14447b7b1html --include-after-body
/tmp/Rtmp7WHAIE/fileb39b143ff6632html --include-after-body
/tmp/Rtmp7WHAIE/fileb39b1345b1dddhtml --mathjax --variable
'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
--include-in-header /tmp/Rtmp7WHAIE/rmarkdown-strb39b160f391de.html
--include-in-header /tmp/Rtmp7WHAIE/fileb39b164361476html
Error in `xml_text<-.xml_node`(`*tmp*`, value = text) :
    STRING_ELT() can only be applied to a 'character vector', not a 'list'
Calls: <Anonymous> ... write_feed_xml -> add_child -> <Anonymous> ->
xml_text<-.xml_node
In addition: There were 20 warnings (use warnings() to see them)
Execution halted

That function `xml_text<-.xml_node` is in the xml2 package, which was updated in early July. Do you think the error has been happening since you updated your copy, or did something else trigger it?

One way to debug this is as follows. With the file in the directory where the error occurs, start R (or RStudio, it shouldn't matter), and run

  debug(xml2:::`xml_text<-.xml_node`)
  rmarkdown::render("creating-a-shiny-server.Rmd")

If you're lucky, the error will happen on the first call to that function, and you can trace into it to see what's so weird. If you're unlucky, it will happen after many calls. Then you'll probably have to use trace() to identify which call causes problems (increment and print a counter on each call), then break just before the bad call and try to see what went wrong.

Duncan Murdoch


It's the same if I do it in Rstudio or from the command line like that
so I think I can safely say it's not an Rstudio issue.

The same happens with other Rmd files in the distill _posts directory.

The really weird aspects are:

1) the html _is_ created fine (but if running in Rstudio it doesn't
transfer to showing you the html)

2) the error message is only there if I run the Rmd in that directory,
i.e. the 2023-08-19-creating-a-shiny-server directory in
_posts or in _posts above that, but I move it up againif I move it to
higher or other directories it works fine:

Rscript -e 'rmarkdown::render("creating-a-shiny-server.Rmd")'


processing file: creating-a-shiny-server.Rmd

output file: creating-a-shiny-server.knit.md

/usr/bin/pandoc +RTS -K512m -RTS creating-a-shiny-server.knit.md --to
html5 --from markdown+autolink_bare_uris+tex_math_single_backslash
--output creating-a-shiny-server.html --lua-filter
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/rmarkdown/rmarkdown/lua/pagebreak.lua
--lua-filter
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/rmarkdown/rmarkdown/lua/latex-div.lua
--wrap preserve --standalone --table-of-contents --toc-depth 4
--variable toc-float=1 --highlight-style
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/distill/rmarkdown/templates/distill_article/resources/arrow.theme
--template
/home/chris/R/x86_64-pc-linux-gnu-library/4.3/distill/rmarkdown/templates/distill_article/resources/default.html
'--metadata=link-citations:true' --include-in-header
/tmp/RtmpGMqTCm/fileb43a436c6281fhtml --include-in-header
/tmp/RtmpGMqTCm/fileb43a455b7e5bdhtml --include-in-header
/tmp/RtmpGMqTCm/fileb43a461db1ea1html --include-in-header
/tmp/RtmpGMqTCm/fileb43a474a6e703html --include-before-body
/tmp/RtmpGMqTCm/fileb43a494bd34html --include-before-body
/tmp/RtmpGMqTCm/fileb43a42fbfec67html --include-before-body
/tmp/RtmpGMqTCm/fileb43a4273d84ebhtml --include-after-body
/tmp/RtmpGMqTCm/fileb43a4725e33cahtml --include-after-body
/tmp/RtmpGMqTCm/fileb43a43d386888html --include-after-body
/tmp/RtmpGMqTCm/fileb43a43f19b459html --mathjax --variable
'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
--include-in-header /tmp/RtmpGMqTCm/rmarkdown-strb43a43033daa0.html
--include-in-header /tmp/RtmpGMqTCm/fileb43a42807e405html

Output created: creating-a-shiny-server.html
Warning message:
In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?

The 20 warnings are:

  > warnings()
Warning messages:
1: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
2: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
3: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
4: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
5: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
6: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
7: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
8: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
9: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
10: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
11: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
12: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
13: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
14: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
15: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
16: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
17: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
18: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
19: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?
20: In as.character.POSIXt(as.POSIXlt(x), ...) :
    as.character(td, ..) no longer obeys a 'format' argument; use
format(td, ..) ?

I'm not convinced that they're related to this as we know that's a issue
that fixed and making its way to CRAN and is only
a warning.

I'm using up to date R on up to date Ubuntu 22.04.3 LTS.

  > sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK:
/usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;
LAPACK version 3.10.0

locale:
   [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
   [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
   [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8
   [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
   [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

time zone: Europe/Paris
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods base

other attached packages:
   [1] lubridate_1.9.2 forcats_1.0.0   stringr_1.5.0 dplyr_1.1.2
   [5] purrr_1.0.2     readr_2.1.4     tidyr_1.3.0 tibble_3.2.1
   [9] ggplot2_3.4.3   tidyverse_2.0.0

loaded via a namespace (and not attached):
   [1] sass_0.4.7        utf8_1.2.3        generics_0.1.3 xml2_1.3.5
   [5] stringi_1.7.12    distill_1.5       hms_1.1.3 digest_0.6.33
   [9] magrittr_2.0.3    evaluate_0.21     grid_4.3.1 timechange_0.2.0
[13] bookdown_0.35     fastmap_1.1.1     rprojroot_2.0.3 jsonlite_1.8.7
[17] fansi_1.0.4       scales_1.2.1      jquerylib_0.1.4 cli_3.6.1
[21] rlang_1.1.1       munsell_0.5.0     withr_2.5.0 cachem_1.0.8
[25] yaml_2.3.7        tools_4.3.1       tzdb_0.4.0 memoise_2.0.1
[29] colorspace_2.1-0  mime_0.12         vctrs_0.6.3 R6_2.5.1
[33] png_0.1-8         lifecycle_1.0.3   fontawesome_0.5.2 pkgconfig_2.0.3
[37] pillar_1.9.0      bslib_0.5.1       gtable_0.3.4 glue_1.6.2
[41] xfun_0.40         tidyselect_1.2.0  highr_0.10 rstudioapi_0.15.0
[45] knitr_1.43        farver_2.1.1      htmltools_0.5.6 rmarkdown_2.24
[49] labeling_0.4.2    compiler_4.3.1    downlit_0.4.3

Really bizarre issue but it's crippling my developing the Distill blog
further as it breaks the otherwise excellent
Rstudio edit/knit/review/edit/knit/review workflow I use.

Appreciate any suggestions: TIA,


Chris



______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to