basename error in bookdown updates - r

I am working on packing my course notes together using bookdown. When I try to view my chapter updates using bookdown:::serve_book() or simply knitting the document (supposedly a shortcut to preview_chapter) I get the error message below. And only after updating.
Error in basename(with_ext(nms, ".html")) : path too long
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> split_chapters -> basename
Please delete MATH456_notes.md after you finish debugging the error.
Execution halted
If I remove the mentioned .md file, AND clean the whole project using rmarkdown::clean_site(), it will compile just fine. But if I make changes, and try to view the update I get the following message.
Any ideas what is going on? I really don't want to rebuild the entire book every time I want to preview the current chapter.
If i'm previewing the book, and make any small change, the auto-update/live preview also throws the same error.

I know this thread is old, but maybe my answer may help others in the future. :) So for all of you who still encounter this error:
For me, the problem can be fixed by checking all headings. Most likely you inserted a hashtag # in the wrong place (i.e. in the body text) without closing it, so Bookdown detects a new main chapter (i.e. level 1) that has an extremely long heading name.
I would recommend saving the index.rmd in a second backup file and then deleting each chapter individually, starting at the bottom. Once your book renders again with no problems, you will know which chapter is causing the problem. Watch out for problematic hashtags # and headings there.

Related

Rendering a Quarto blog post trips an error when reading in a brms file object

First, I'll apologize for not having a fuller reproducable example, but I'm not entirely sure how to go about that given the various layers to the question/problem.
I'm moving a blog over from Blogdown to a new Quarto-based website and blog. I have three saved brms object files that I'm trying to read into a code chunk in one of the posts. The code chunks work fine when I run them manually, but when I try to render the blog post I get the following error:
Quitting from lines 75-86 (tables-modelsummary-brms.qmd)
Error in stri_replace_all_charclass(str, "[\\u0020\\r\\n\\t]", " ", merge = TRUE) :
invalid UTF-8 byte sequence detected; try calling stri_enc_toutf8()
Calls: .main ... stri_trim -> stri_trim_both -> stri_replace_all_charclass
Execution halted
I've checked the primary data frame contained in the brms model object and all of the character vectors there are valid UTF-8 vectors. These models objects can be quite large, so it's possible I'm missing something buried deep within the model object, but so far it's nothing apparent.
I tried re-running the models again to ensure that the model objects' files weren't corrupted, and also to make sure that the encoding issue wasn't somehow introduced the last time they were run, which would have been on a Windows machine and a different version of brms.
I've also moved the brms files around to different directories to see if it's a file path issue. The same error comes up regardless of whether the files are in the same folder as the blog post qmd file or in a parent directory file I use for storing site data.
I've also migrated several other posts to the new Quarto site successfully, and some of them also contain R code, but it's all rendering without a problem.
Finally, I don't quite understand how to implement the suggersted alternate function found in the error message either.

#title Missing name at line 1

I was getting this error when running devtools::document but had no idea how to troubleshoot. The file that popped up on my installed package when I entered ?MyPackage-package did not match the text in MyPackage-package.R at all. I initially suspected it might have been from adding the awesome citation functionality from RDpack, but this was not the culprit. How did I go about ultimately fixing the problem?
The error resulted from incorrect formatting in my PackageName-package.R file.
I had heavily edited the file created by usethis::use_package_doc(), and added all of my roxygen comments Below the default content added by usethis. After looking at the documentation for merTools, I saw that it was ok to have the stuff I understand to be important for roxygen2 to make the .Rd files after and not before all the other roxygen comments.
After moving the stuff created by usethis::use_package_doc() (and not just the NULL line; that was already at the end) to the bottom of the .R file, everything seemed to render fine and this error disappeared.

Rmarkdownon Kaggle: Can you spot what's going on?

it's been a few days that im trying to run my Rmd on Kaggle, but it simply doesn't work.
The main reason (I guess) is that, somehow the console is reading the code as an R code, but im sure that I'm using Rmarkdown.
Therefore, the console reads a Text line as a code line, giving me the code error below:
Also, i tried to copy and edit other's people markdown, but i keep getting the same error line.
You can check my code here: https://www.kaggle.com/badluckmath/kernel4c85aae59c/edit/run/39891200
He's working perfectly on my Rstudio.
I'm looking for a huge help here, please!
I've been stuck with this for a week!
If i press the buttom to run code, it will simply give me this error message.
For that, i still don't know the solution. But since this is a premade Rmarkdown and i knew that it works, i simple used the Save (Commit) options and at the end, it worked.

Text line contains an invalid character

I am currently writing my bachelor thesis using Rmarkdown, and whenever i make changes I knit to PDF to check how it looks etc.
It worked perfectly until I wanted to check some small changes and after that I canĀ“t get it to knit, this is the error message I get:
output file: bbb.knit.md
! Text line contains an invalid character.
l.28 pdftitle={^^K
space{3.5in} Portfolio},
Error: Failed to compile bbb.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See bbb.log for more info.
Bare in mind that I am learning R while writing my thesis so I do have a very low level of knowledge. Does anyone have any suggestions for where the mistake might be? Line 28 has no text by the way.
I have read some suggestions about deleting the auxiliary file but I dont even know what that is or where to find it, or if it could cause me any problems deleting it.
Hope someone has some tips as wasting a lot of time on this is the last I need right now! Thanks
The solution was to change the title input in YAML from "\vspace{3.5in} Portfolio"
to only "Portfolio".

Need to have the source created with Rmarkdown otherwise error message

Hello StackOverflow community,
I have been trying over the last few weeks using R Markdown to Knit HTML file.
While it use to run smoothly the previous time, over the last week I keep on getting the following error
Quitting from lines 43-92 (Vizualisation.Rmd)
Error in eval(lhs, parent, parent) :
object 'processed.feedback' not found
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> %>% -> eval -> eval
Execution halted
The thing is that my source 'processed.feedback' is loaded within my Global environment. But is not created with the .rmd but before in a script file.
If I do the wrangling as well in the same Rmarkdown the it works fine (no error). But I would love to keep the wrangling part in a separate file.
Any suggestion.
Thanks in advance for your feedback and help!
If you are at the Rstudio conference - enjoy!
The usual model is that R Markdown files do not see objects that are in your workspace: they start with a blank workspace, so that anyone can reproduce the computation. (There are ways to work in an existing workspace, but you shouldn't use them.)
If it takes too long to create an object in the Rmd code, then there are at least two options: turn on caching (so it only happens when necessary), or save the object in a separate file using save() and load it in your document using load(). Remember to distribute the save file along with the .Rmd file if you want to give this document to someone else.

Resources