Packages bundle functions, data, and docs—install from CRAN with install.packages(), load with library(). Use renv locally to pin versions per project.
Install and load (local)
install.packages("dplyr")
library(dplyr)
Namespace
dplyr::filter() calls explicitly without attaching—avoids masking base filter conflicts.
Important interview questions and answers
- Q: library vs require?
A: require returns FALSE if missing; library errors—use require for optional deps. - Q: CRAN vs Bioconductor?
A: CRAN general; Bioconductor genomics—different install repositories.
Self-check
- What installs packages?
- Why use package::function()?
Pitfall: Attaching many packages masks functions—prefer dplyr::filter() over blind library().
Interview prep
- library vs ::?
package::fn()avoids masking conflicts from attaching many libraries.