tidymodels / TMwR

Code and content for "Tidy Modeling with R"
https://tmwr.org
Other
579 stars 272 forks source link

Error in pkg(tidymodels) #343

Closed fdepaolis closed 1 year ago

fdepaolis commented 1 year ago

When running bookdown::render_book("index.Rmd", "bookdown::gitbook")

I get the following:

processing file: _main.Rmd |............. | 14% inline R code fragments

Quitting from lines 2-43 (_main.Rmd) Error in pkg(tidymodels) : could not find function "pkg"

And I couldn't find any support on pkg() anywhere. Thank you

juliasilge commented 1 year ago

If you are wanting to render the book yourself, you should be aware that it takes a very, very long time (it takes 4+ hours on GitHub actions).

The pkg() function is in _common.R:

https://github.com/tidymodels/TMwR/blob/ce2b4fc2177e385c7fd29ecf0ebce0219e050ce2/_common.R#L39-L43

Which we tell bookdown to use here:

https://github.com/tidymodels/TMwR/blob/ce2b4fc2177e385c7fd29ecf0ebce0219e050ce2/_bookdown.yml#L35

I expect that you have maybe changed or are not using one of these?

fdepaolis commented 1 year ago

Thank you for your detailed explanation. No, I wasn't planning on actually building the html files...but thank you for the warning about the time it takes. For some reason, the pkg function wasn't loaded. I'm not sure there is something missing or if others have encountered the same issue when running the instructions in "Readme.md." There is no mention of having to run the ".R" scripts. Also, I was curious because the title is "Reproducing the book or results" and I was more interested in the results. I seemed to me that it was easier just to read the book from the website (https://www.tmwr.org). In any case, thank you very much.

juliasilge commented 1 year ago

You don't have to run those scripts manually; they get picked up automatically by bookdown if the yaml file is in the right spot. You can see how GH Actions builds the book here:

https://github.com/tidymodels/TMwR/blob/ce2b4fc2177e385c7fd29ecf0ebce0219e050ce2/.github/workflows/bookdown.yaml#L37

It's definitely easier to read the book as rendered online! Let us know if you have further questions.

fdepaolis commented 1 year ago

Thank you!!!

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.