Closed lanstonchu closed 3 years ago
Can you tell me in what situations you are experiencing map()
being masked and not being found? You can check out here that these files build the book as you see it online.
If I knit "05-document-term-matrices.Rmd" directly in RStudio, I got "Line 299 Error: Problem with 'mutate()' input 'corpus'. x could not find function "map" i Input 'corpus' is 'map(corpus, tidy)'. The problem is solved when I used purrr::map instead of map. The "06-topic-models.Rmd" situation is just similar.
Am I generating the book chapters correctly? Or should I use another way to generate the entire book instead of doing it chapters by chapters?
Ah, yep, these files aren't standalone .Rmd
files that will knit on their own. These are part of the bookdown project as a whole. If you clone the whole repo and have the correct package versions installed (hopefully, you can get them via devtools::install_dev_deps()
), then you can build the book, as shown here.
If you want details, the issue in Chapter 5 is that library(purrr)
is called in an eval = FALSE
chunk. It is not evaluated live because of the downloading, which was done once at a certain point when we wrote the book. Each chapter runs the _common.R
script in its new session before knitting.
I know everyone has different learning goals/styles, but if your goal is to learn the content as you work through the chapters, there might be better options than building the whole book locally, which is a bit of heavy lift. Notice the "Copy" buttons on all the code blocks, and remember the options like "run current chunk" and "run all chunks above", etc. If you really want to knit each chapter, you could source("_common.R")
first?
Thank you for your advice on this, which helps a lot.
You are welcome! 🙌
added "purrr::" to avoid error. Sometimes the map() is masked and cannot be found