The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Destructuring assignments in R with the .
object.
library(dotty)
# extract number of rows, number of columns from mtcars
<- dim(mtcars)
.[nr, nc] c(nr, nc)
## [1] 32 11
# extract first, last element of vector
<- c(1, 2, 3, 4, 5)
.[first, .., last] c(first, last)
## [1] 1 5
# extract a value by name
= beta] <- list(alpha = 1, beta = 2, gamma = 3)
.[beta beta
## [1] 2
# unpack nested values
<- list(1, list(2, list(3)))
.[x, .[y, .[z]]] c(x, y, z)
## [1] 1 2 3
# split version components
<- getRversion()
.[major, minor, patch] c(major, minor, patch)
## [1] 4 4 1
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:
.onLoad <- function(libname, pkgname) {
dotty::dotify()
}
This function patches codetools so
that variables usages in .
expressions can be linted as
though those were regular bindings / assignments.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.