library(tidyverse, quietly = TRUE)
mtcars |>
group_by(cyl) |>
summarize(count = n()) |>
rename("class" = cyl)# A tibble: 3 × 2
class count
<dbl> <int>
1 4 11
2 6 7
3 8 14
R packagesR package and when should I make one?R package is a collection of functions, tests, data, compiled code, and standardized documentationR packages are created:
R packages in particular are used quite heavily for this)Source: Lecture notes from UBC’s DSCI 310 course (Reproducible and Trustworthy Workflows for Data Science)
mtcars (composed of 32 observations) have 4, 6, and 8 cylindersR package the answer to our pains with how we have been previously trying to reuse our code?Yes, it is!
R packages shared and downloaded?R packages can be shared and downloaded using code repositories, like GitHubCRAN is a network of ftp and web servers around the world that store identical, up-to-date, versions of code and documentation for
R.
R packages via a toy example