cosname / rmarkdown-guide

R Markdown 指南(一本八字还没一撇的中文书)
https://cosname.github.io/rmarkdown-guide/
80 stars 28 forks source link

项目build出错。 #78

Closed icejean closed 1 year ago

icejean commented 2 years ago

Hi,大家好, 最近在学习R markdown,了解到这本正在写作中的书,下载了项目尝试build一下,有几个小问题反馈一下。 1、 01-intro.Rmd 1)、images/01-notebook-preview.jpg应改为images/01-notebook-preview.png,并重命名文件, png格式。

knitr::include_graphics("images/01-notebook-preview.png")

2、images/01-dynamic-document.jpg应改为images/01-dynamic-document.png,并重命名文件, png格式。

knitr::include_graphics("images/01-dynamic-document.png")

2、build HTML与word都可以,但build PDF出错,不知到写作团队测试过build PDF没有。我是菜鸟,还无法定位解决问题。不过知道PDF中laTeX数学公式等的效果比Word要方便很多和好很多。

#sucess
bookdown::render_book('index.Rmd',"bookdown::word_document2")
#Failed
bookdown::render_book('index.Rmd',"bookdown::pdf_book")

Error message:

Error in seq.default(dots[[1L]][[5L]], dots[[2L]][[5L]]) : 
  'to' must be a finite number
In addition: Warning messages:
1: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead. 
2: In system2("python", c("-c", shQuote(code)), stdout = TRUE) :
  running command '"python" -c "print(1 + 1)"' had status 9009
3: In eval_asy() :
  System set-up not compatible with Asymptote, so chunks with asy engine will be skipped.
4: In eval_asy() :
  System set-up not compatible with Asymptote, so chunks with asy engine will be skipped.
5: In png::readPNG(path, native = TRUE, info = TRUE) :
  Image uses 16-bit channels but R native format only supports 8-bit, truncating LSB.
6: In knitr::write_bib(c(.packages(), "bookdown", "knitr", "rmarkdown",  :
  package(s) flextable, gt, gtsummary, formattable, reactable, rhandsontable, pixiedust, stargazer, tables, tangram, ztable, condformat, printr, styler, ezknitr, rmdformats, learnr, blogdown, spelling, blastula, workflowr, xaringanthemer, diagram, rmdrive, xaringanExtra, fusen not found
7: In utils::citation(..., lib.loc = lib.loc) :
  no date field in DESCRIPTION file of package 'datadrivencv'
8: In utils::citation(..., lib.loc = lib.loc) :
  could not determine year for 'datadrivencv' from package DESCRIPTION file
9: In utils::citation(..., lib.loc = lib.loc) :

 Error in seq.default(dots[[1L]][[5L]], dots[[2L]][[5L]]) : 
  'to' must be a finite number 
gaospecial commented 2 years ago

Thanks for your comment. PDF is failed in my computer too, I don't find out a solution for this now.

qiushiyan commented 2 years ago

这个错误应该是这一行导致的,注释掉之后是其他错误

https://github.com/cosname/rmarkdown-guide/blob/e24c2dfa4ed24b32fa9acb619d9ca4dbe345bf37/index.Rmd#L55

icejean commented 2 years ago

你直接在Rstudio中展开错误之处的stack trace就可以定位到这一行了,不过怎么解决?8-)

bookdown::render_book('index.Rmd',"bookdown::pdf_book")
......
output file: rmarkdown-guide.knit.md

"D:/R/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS rmarkdown-guide.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output rmarkdown-guide.tex --lua-filter "C:\Users\Jean\AppData\Local\R\cache\R\renv\cache\v5\R-4.1\x86_64-w64-mingw32\bookdown\0.26\65ebdc552e88fc98c596f4797c5415ad\bookdown\rmarkdown\lua\custom-environment.lua" --lua-filter "C:\Users\Jean\AppData\Local\R\cache\R\renv\cache\v5\R-4.1\x86_64-w64-mingw32\rmarkdown\2.14\31b60a882fabfabf6785b8599ffeb8ba\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\Jean\AppData\Local\R\cache\R\renv\cache\v5\R-4.1\x86_64-w64-mingw32\rmarkdown\2.14\31b60a882fabfabf6785b8599ffeb8ba\rmarkdown\rmarkdown\lua\latex-div.lua" --metadata-file "C:\Users\Jean\AppData\Local\Temp\Rtmpwn901r\file193c06de27a8" --self-contained --table-of-contents --toc-depth 3 --template "latex\template.tex" --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header "latex\preamble.tex" --include-before-body "latex\before_body.tex" --include-after-body "latex\after_body.tex" --wrap preserve --top-level-division=chapter --variable tables=yes --standalone -Mhas-frontmatter=false 
Error in seq.default(dots[[1L]][[5L]], dots[[2L]][[5L]]) : 
  'to' must be a finite number
In addition: Warning messages:
1: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> = "none")` instead. 
2: In system2("python", c("-c", shQuote(code)), stdout = TRUE) :
  running command '"python" -c "print(1 + 1)"' had status 9009
3: In eval_asy() :
  System set-up not compatible with Asymptote, so chunks with asy engine will be skipped.
4: In eval_asy() :
  System set-up not compatible with Asymptote, so chunks with asy engine will be skipped.
5: In png::readPNG(path, native = TRUE, info = TRUE) :
  Image uses 16-bit channels but R native format only supports 8-bit, truncating LSB.
6: In knitr::write_bib(c(.packages(), "bookdown", "knitr", "rmarkdown",  :
  package(s) flextable, gt, gtsummary, formattable, reactable, rhandsontable, pixiedust, stargazer, tables, tangram, ztable, condformat, printr, styler, ezknitr, rmdformats, learnr, blogdown, spelling, blastula, workflowr, xaringanthemer, diagram, rmdrive, xaringanExtra, fusen not found
7: In utils::citation(..., lib.loc = lib.loc) :
  no date field in DESCRIPTION file of package 'datadrivencv'
8: In utils::citation(..., lib.loc = lib.loc) :
  could not determine year for 'datadrivencv' from package DESCRIPTION file
9: In utils::citation(..., lib.loc = lib.loc) :

 Error in seq.default(dots[[1L]][[5L]], dots[[2L]][[5L]]) : 
  'to' must be a finite number 
10.
stop("'to' must be a finite number") 
9.
seq.default(dots[[1L]][[5L]], dots[[2L]][[5L]]) 
8.
(function (...) 
UseMethod("seq"))(dots[[1L]][[5L]], dots[[2L]][[5L]]) 
7.
mapply(seq, i1, i2, SIMPLIFY = FALSE) at <text>#29
6.
unlist(mapply(seq, i1, i2, SIMPLIFY = FALSE)) at <text>#29
5.
post(x) 
4.
output_format$post_processor(front_matter, input, output_file, 
    clean, !quiet) 
3.
rmarkdown::render(main, output_format, ..., clean = clean, envir = envir) 
2.
render_cur_session(files, main, config, output_format, clean, 
    envir, ...) 
1.
bookdown::render_book("index.Rmd", "bookdown::pdf_book") 

> 
qiushiyan commented 1 year ago

see #81