-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add argument to **unname_all_chunks** specifying which chunks to unname #22
Conversation
unname_all_chunks now accepts argument `ch_n_p` with the prefix of the chunknames to be unnamed
Following up on the coverage test I see that I will have to add to |
added test for case is.null(ch_n_p) == FALSE changed test for case is.null(ch_n_p) == TRUE
👋 @HanOostdijk, thanks for your PR! It is a generally welcome feature, I'll comment about details. |
I'd prefer the name of the argument to be longer and therefore more explicit e.g. |
implemented the changes suggested by reviewer
unname_all_chunks: made sure 'setup' is not unnamed testthat/test-unname_all_chunks: added test for this
@HanOostdijk I've pushed minimal changes to your branch and will merge if you agree with my adding you as contributor to DESCRIPTION. I did that via |
One last thing actually, could you please add a paragraph about your use case in the vignette and README after "There's also |
DESCRIPTION: added ORCID README.md: added use case unname_all_chunks vignette: added use case and example
role = "ctb")) | ||
role = "ctb", | ||
comment = structure("0000-0001-6710-4566", .Names = "ORCID")) | ||
) | ||
Description: It names the 'R Markdown' chunks of files based on the filename. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay ORCID 🎉
The current version of unname_all_chunks removes all chunk labels except
setup
.My proposal is to add an argument
chunk_name_prefix
(chunk name prefix) that when used will indicate which labels will be unnamed by specifying the prefix of these labels.The default value for this argument is
NULL
and in that case the current processing will be done: all labels removed exceptsetup
.For the two cases an example is given in the documentation of the function unname_all_chunks.
Use case: I sometimes refer to existing labels by using the chunk option
ref.label
. For an example ofref.label
see e.g. Chunk Reference/Macro . After usingname_chunks
I have a set with 'own' labels and a set with 'generated' labels. When I later decide that I want to insert new chunks, I would prefer to unname only the 'generated' labels and then applyname_chunks
again. With the suggested change, this can be done by specifying aschunk_name_prefix
'the filename with extension stripped' followed with a '-' (dash) that is used inname_chunks
.Apart from unname_all_chunks I also inserted a second named chunk in example4.Rmd in the example folder.
I am not very familiar with the PR process. Let me know when I made mistakes.
Edited:
ch_n_p
argument renamed tochunk_name_prefix
following suggestion by reviewerstringr
is removed because thestringr
functions are no longer used