Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R file produced by rjournal_article is not replaced by new one #394

Closed
cderv opened this issue Apr 30, 2021 · 5 comments
Closed

R file produced by rjournal_article is not replaced by new one #394

cderv opened this issue Apr 30, 2021 · 5 comments

Comments

@cderv
Copy link
Collaborator

cderv commented Apr 30, 2021

We forgot to set overwrite = FALSE here I think:

file.copy(output_R, xfun::with_ext(filename, "R"))

Meaning that the new purled R file was not copied to the output dir unless the previous one was cleaned. No error or warning issued with file.copy in this case...

That is nasty bug I think. But with an easy fix

Thanks @apreshill for finding this

@cderv cderv closed this as completed in d93d50b Apr 30, 2021
@Enchufa2
Copy link

Enchufa2 commented Aug 6, 2021

I suppose this is a feature to automatically generate the replication script from the Rmd. But I always maintain a separate filename.R replication script, and now it gets overwritten after this change. Is there an option to switch off this feature?

@Enchufa2
Copy link

Enchufa2 commented Aug 6, 2021

I see no way to switch this off. And given that previously it was possible to maintain a custom replication script, I consider this a regression. A proper fix would be to add some comment to the generated file (like "this was automatically generated, do not edit by hand"), and only overwrite it if such comment is present. In this way, previous behavior would be preserved, as well as the originally intended feature.

@cderv
Copy link
Collaborator Author

cderv commented Aug 16, 2021

Hi @Enchufa2 !

Thanks for the report. This is indeed something we did not think through. The feature is to automatically generate the R script from the content of the Rmd file (using knitr::purl()), however we assume the R file is indeed only produced by rticles. We need to provide a way to opt-out for manual workflown like yours.

We could also provide an argument in the function to opt-out this:

output: 
  rjournal_article: 
    purl: false

I like your suggestion though with the special comment in the script.

I'll open an issue to track your report specifically.

@Enchufa2
Copy link

Nice, thanks!

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants