Get access to all lessons in this course.
-
Setup packages
- devtools and usethis
- Package names and authors
- Choose a license
- Setup git + GitHub
-
Write code
- Writing functions
- Adding functions to our package
- Using other packages
- Packages so good they get their own functions
- Organizing .R files
-
Document
- roxygen2: In-Line Documentation for R
- Argument descriptions and examples
- Helper functions
- Joining documentation
-
Test
- Unit tests for R
- Organizing tests
- R CMD Check
- Types of Test Files
- Test Coverage
-
Teach
- Examples
- README
- Spellcheck
-
Add data and files
- Store data and files
- Include data for tests and create RMarkdown templates
- Create other templates
- Launch and store Shiny apps
- Citations, ignoring files, and including add-ins
Package Development with R
Using other packages
This lesson is locked
This lesson is called Using other packages, part of the Package Development with R course. This lesson is called Using other packages, part of the Package Development with R course.
Transcript
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Your Turn
Working in exercises.Rmd:
Fix the code in R/themes.R to use ggplot2:: instead of library(ggplot2)
Run use_package(“ggplot2”) to add ggplot2 to Imports
Re-load the package (Cmd/Ctrl+Shift+L) and run this code to make sure it works
use_package("ggplot2")
### in R/themes.R:
theme_avalanche <- function() {
ggplot2::theme_minimal(base_size = 14) +
ggplot2::theme(panel.grid.minor = ggplot2::element_blank())
}
Learn More
You can learn more about using functions from other packages in your package in the Dependencies chapter of the R Packages book.
You need to be signed-in to comment on this post. Login.