Destructuring assignments in R with the . object.
Usage
library(dotty)
# extract number of rows, number of columns from mtcars
.[nr, nc] <- dim(mtcars)
c(nr, nc)
# extract a value by name
.[beta = beta] <- list(alpha = 1, beta = 2, gamma = 3)
beta
# split version components
.[major, minor, patch] <- getRversion()
c(major, minor, patch)R CMD check
If you’d like to use dotty in your CRAN package, you can avoid R CMD check warnings by including a file called R/zzz.R with the contents:
This function patches codetools so that variables usages in . expressions can be linted as though those were regular bindings / assignments.