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

Set up commonly used 📦 components

License

Unknown, MIT licenses found

Licenses found

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

r-lib/usethis

R-CMD-checkCRAN statusLifecycle: stableCodecov test coverageR-universe version

usethis is a workflow package: it automates repetitive tasks that ariseduring project setup and development, both for R packages andnon-package projects.

Installation

Install the released version of usethis from CRAN:

install.packages("usethis")

Or install the development version from GitHub with:

# install.packages("pak")pak::pak("r-lib/usethis")

Usage

Mostuse_*() functions operate on theactive project: literally, adirectory on your computer. If you’ve just used usethis to create a newpackage or project, that will be the active project. Otherwise, usethisverifies that current working directory is or is below a valid projectdirectory and that becomes the active project. Useproj_get() orproj_sitrep() to manually query the project andread more in thedocs.

A few usethis functions have no strong connections to projects and willexpect you to provide a path.

usethis is quite chatty, explaining what it’s doing and assigning youtasks. indicates something usethis has done for you. indicatesthat you’ll need to do some work yourself.

Below is a quick look at how usethis can help to set up a package. Butremember, many usethis functions are also applicable to analyticalprojects that are not packages.

library(usethis)# Create a new package -------------------------------------------------path<- file.path(tempdir(),"mypkg")create_package(path)#> ✔ Creating '/tmp/RtmpPZsquk/mypkg/'.#> ✔ Setting active project to "/private/tmp/RtmpPZsquk/mypkg".#> ✔ Creating 'R/'.#> ✔ Writing 'DESCRIPTION'.#> Package: mypkg#> Title: What the Package Does (One Line, Title Case)#> Version: 0.0.0.9000#> Authors@R (parsed):#>     * First Last <first.last@example.com> [aut, cre]#> Description: What the package does (one paragraph).#> License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a#>     license#> Encoding: UTF-8#> Roxygen: list(markdown = TRUE)#> RoxygenNote: 7.3.2#> ✔ Writing 'NAMESPACE'.#> ✔ Setting active project to "<no active project>".# only needed since this session isn't interactiveproj_activate(path)#> ✔ Setting active project to "/private/tmp/RtmpPZsquk/mypkg".#> ✔ Changing working directory to '/tmp/RtmpPZsquk/mypkg/'# Modify the description ----------------------------------------------use_mit_license("My Name")#> ✔ Adding "MIT + file LICENSE" to 'License'.#> ✔ Writing 'LICENSE'.#> ✔ Writing 'LICENSE.md'.#> ✔ Adding "^LICENSE\\.md$" to '.Rbuildignore'.use_package("rmarkdown","Suggests")#> ✔ Adding rmarkdown to 'Suggests' field in DESCRIPTION.#> ☐ Use `requireNamespace("rmarkdown", quietly = TRUE)` to test if rmarkdown is#>   installed.#> ☐ Then directly refer to functions with `rmarkdown::fun()`.# Set up other files -------------------------------------------------use_readme_md()#> ✔ Writing 'README.md'.#> ☐ Update 'README.md' to include installation instructions.use_news_md()#> ✔ Writing 'NEWS.md'.use_test("my-test")#> ✔ Adding testthat to 'Suggests' field in DESCRIPTION.#> ✔ Adding "3" to 'Config/testthat/edition'.#> ✔ Creating 'tests/testthat/'.#> ✔ Writing 'tests/testthat.R'.#> ✔ Writing 'tests/testthat/test-my-test.R'.#> ☐ Edit 'tests/testthat/test-my-test.R'.x<-1y<-2use_data(x,y)#> ✔ Adding R to 'Depends' field in DESCRIPTION.#> ✔ Creating 'data/'.#> ✔ Setting 'LazyData' to "true" in 'DESCRIPTION'.#> ✔ Saving "x" and "y" to "data/x.rda" and "data/y.rda".#> ☐ Document your data (see <https://r-pkgs.org/data.html>).# Use git ------------------------------------------------------------use_git()#> ✔ Initialising Git repo.#> ✔ Adding ".Rproj.user", ".Rhistory", ".RData", ".httr-oauth", ".DS_Store", and#>   ".quarto" to '.gitignore'.

Code of Conduct

Please note that the usethis project is released with aContributorCode of Conduct. Bycontributing to this project, you agree to abide by its terms.

About

Set up commonly used 📦 components

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Contributing

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp