-
-
Notifications
You must be signed in to change notification settings - Fork 878
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 a helper for automatic naming of unnamed code chunks #2228
Comments
Thanks for the suggestion ! This would be an issue for the RStudio IDE (https://github.com/rstudio/rstudio) as this is where the I believe this is a great suggestions and you should open there if there are none on that topic already
We could do something like namer to "fix" a document by naming the unnamed chunk. Historically, knitr is labelling chunk internally using We need to think about it. 🤔 @yihui some thoughts about a helper function to modify a Rmd source to add random name to unnamed chunks ? |
Thanks for the clarification, @cderv ! I wasn't confident that this belonged in knitr but it was my best guess (and, not surprisingly, wrong). I'll open a different feature request ticket in rstudio. I agree that there's a package that solves this issue, but it's such a basic and common problem that I personally think it shouldn't rely on an external package and should instead somehow be smoothly integrated into the user experience. Thanks for your time and consideration! |
Yes, we can do that. Naming is hard (except for totally random names), though. |
Feature request: Could you add automatic naming of code chunks when inserting new chunk?
Justification: I create new code chunks via Ctrl + Alt + I. Sometimes I write sensible names for the code chunks, and sometimes I don't bother and instead leave them unnamed. When I knit and see messages/warnings in, eg, Unnamed Code Chunk 23, I am less likely to investigate whether or not this message/warning needs to be addressed when I have no idea what code chunk it originated from. That's definitely bad practice on my part.
Solution: I am aware of
namer
but (1) I think the warning re: version control is a bit off-putting as a newer user to git and (2) I think this functionality should be incorporated directly into rmarkdown/knitr. I could envision a small random string of letters or a more human-readable random 2-or-3 word string (eg as GitHub does for new repo naming suggestions). If it adds complexity, I don't think there needs to be any overhead re: ensuring no repeats of names since, when duplicate code chunk names are found, that error is thrown so quickly upon rendering.Thank you so much for considering this!
I conflate
knitr
andrmarkdown
so apologies if this is the wrong location for this feature request.By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: