MilesMcBain / tflow

An opinionated lightweight template for smooth targets flows.
Other
90 stars 9 forks source link

Rmd template #7

Closed Aariq closed 3 years ago

Aariq commented 3 years ago

Makes the changes suggested in #5. I added here and withr to "Suggests" since they are now suggested by comments in the Rmd template.

MilesMcBain commented 3 years ago

Thanks for the contribution!

I think the withr requirement to make load and read work is due to an RStudio quirk. From what I understand, if you disable in-line chunk output then the working directory for the chunk execution will become the project root directory and they will work. See: https://github.com/rstudio/rstudio/issues/2595#issuecomment-379913414

The comments relating to withr could stay in the template, but with an added note that they apply only to RStudio users who use the inline chunk output setting.

Aariq commented 3 years ago

Yeah, when tar_load() is run in the console, or by a chunk that outputs to the console, it works. However, a naked tar_load() also fails upon clicking the "knit" button and with rmarkdown::render(), even with in-line chunk output disabled. I'm not sure it's this exact quirk of RStudio, but it is some RStudio weirdness. But I'm happy to clarify that the withr wrapper is only needed in those cases.

MilesMcBain commented 3 years ago

Knit/Render not working outside of the make process could also be viewed as a feature since doing this introduces the opportunity for the Rmd output to become desynchronised with code in the repo.

For example if code had been committed, but the report knitted outside of the project pipeline using cached targets, the reproducibility receipt at the end of the report will claim the output was built against a certain commit, which would not be true.

MilesMcBain commented 3 years ago

thanks for the contribution @Aariq!

MilesMcBain commented 3 years ago

Also feel free to add yourself as 'ctb' to the DESCRIPTION file!