R Packages organize, test, document, and share your code /
Turn your R code into packages that others can easily install and use. With this fully updated edition, developers and data scientists will learn how to bundle reusable R functions, sample data, and documentation together by applying the package development philosophy used by the team that maintains...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Otros Autores: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Sebastopol :
O'Reilly Media, Incorporated,
2023.
|
Edición: | 2nd ed. |
Temas: | |
Acceso en línea: | Texto completo (Requiere registro previo con correo institucional) |
Tabla de Contenidos:
- Intro
- Copyright
- Table of Contents
- Preface
- Welcome!
- Introduction
- Philosophy
- In This Book
- What's Not Here
- Conventions Used in This Book
- Colophon
- O'Reilly Online Learning
- How to Contact Us
- Acknowledgments
- Part I. Getting Started
- Chapter 1. The Whole Game
- Load devtools and Friends
- Toy Package: regexcite
- Preview the Finished Product
- create_package()
- use_git()
- Write the First Function
- use_r()
- load_all()
- Commit strsplit1()
- check()
- Edit DESCRIPTION
- use_mit_license()
- document()
- NAMESPACE Changes
- check() Again
- Install()
- use_testthat()
- use_package()
- use_github()
- use_readme_rmd()
- The End: check() and install()
- Review
- Chapter 2. System Setup
- devtools, usethis, and You
- Personal Startup Configuration
- R Build Toolchain
- Windows
- macOS
- Linux
- Verify System Prep
- Chapter 3. Package Structure and State
- Package States
- Source Package
- Bundled Package
- .Rbuildignore
- Binary Package
- Installed Package
- In-Memory Package
- Package Libraries
- Chapter 4. Fundamental Development Workflows
- Create a Package
- Survey the Existing Landscape
- Name Your Package
- Package Creation
- Where Should You create_package()?
- RStudio Projects
- Benefits of RStudio Projects
- How to Get an RStudio Project
- What Makes an RStudio Project?
- How to Launch an RStudio Project
- RStudio Project Versus Active usethis Project
- Working Directory and Filepath Discipline
- Test Drive with load_all()
- Benefits of load_all()
- Other Ways to Call load_all()
- check() and R CMD check
- Workflow
- Background on R CMD check
- Chapter 5. The Package Within
- Alfa: A Script That Works
- Bravo: A Better Script That Works
- Charlie: A Separate File for Helper Functions
- Delta: A Failed Attempt at Making a Package
- Echo: A Working Package
- Foxtrot: Build Time Versus Run Time
- Golf: Side Effects
- Concluding Thoughts
- Script Versus Package
- Finding the Package Within
- Package Code Is Different
- Part II. Package Components
- Chapter 6. R Code
- Organize Functions Into Files
- Fast Feedback via load_all()
- Code Style
- Understand When Code Is Executed
- Example: A Path Returned by system.file()
- Example: Available Colors
- Example: Aliasing a Function
- Respect the R Landscape
- Manage State with withr
- Restore State with base::on.exit()
- Isolate Side Effects
- When You Do Need Side Effects
- Constant Health Checks
- Chapter 7. Data
- Exported Data
- Preserve the Origin Story of Package Data
- Documenting Datasets
- Non-ASCII Characters in Data
- Internal Data
- Raw Data File
- Filepaths
- pkg_example() Path Helpers
- Internal State
- Persistent User Data
- Chapter 8. Other Components
- Other Directories
- Installed Files
- Package Citation
- Configuration Tools
- Part III. Package Metadata
- Chapter 9. DESCRIPTION
- The DESCRIPTION File