Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

R package 📦 for labelling chunks of RMarkdown files! 💥

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

jumpingrivers/namer

Lifecycle: stableR-CMD-checkCRAN statusCodecov test coverageR-CMD-check

The goal of {namer} is to name the chunks of R Markdown files. It’s yoursafety net when you’ve (willingly) forgotten to name most chunks of allR Markdown files in a folder. {namer} doesnot give meaningful labelsto your chunks, but it gives them labels that won’t change depending ontheir position like the automaticknitr:::unnamed_chunk function doeswhen knitting. So you can e.g. shuffle your chunks and not loose theircache, or more easily debug over a whole folder!

For context aboutwhy you should name your R Markdown chunks, readthis blog post.

The screenshot below isa real lifeexample, resultof runningnamer::name_dir_chunks("pres"). In each of the files in thedir “pres”, it labelled chunks using the filename and numbers.

Example of use

Use

This is a basic example which shows you how to solve a common problem.The “test” folder first contains R Markdown files with unnamed chunks.After runningname_dir_chunks, they’re all named, with names using thefilenames as basis.

fs::dir_copy(system.file("examples",package="namer"),"test")name_dir_chunks("test")file.edit("test/example1.Rmd")

There’s alsoname_chunks() for use on a single R Markdown file; andunname_chunks() to unname all chunks of a single R Markdown file aswell asunname_dir_chunks() to unname all chunks of all R Markdownfiles in a directory, which can be useful when cleaning your chunklabels.

By defaultunname_chunks() unnames all chunks with exception of the‘setup’ chunk. By using the argumentchunk_name_prefix one canindicate the prefix of the labels that will be unnamed. Useful when onerefers to a label by using chunk optionref.label so that it isinconvenient when that label is unnamed. By settingchunk_name_prefixequal to ‘the filename with extension stripped’ followed with a ‘-’(dash) only the labels generated byname_chunks() will be unnamed.

If you’re working with RStudio, installing the package will haveinstalled an addin for labelling chunks ofany R Markdown document youselect.

When using {namer}, please check the edits before pushing them to yourcode base. Such automatic chunk labelling is best paired withversioncontrol.

Installation

Install {namer} from CRAN

install.packages("namer")

Or get the dev version from this repo using:

remotes::install_github("jumpingrivers/namer")

Code of Conduct

Please note that the namer project is released with aContributor Codeof Conduct.By contributing to this project, you agree to abide by its terms.


Maintained byJumping Rivers

About

R package 📦 for labelling chunks of RMarkdown files! 💥

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors12

Languages


[8]ページ先頭

©2009-2025 Movatter.jp