. | R Documentation |
Use 'dotty' to performed destructuring assignments. Please see the examples below for usages.
.
An object of class dotty
of length 0.
# extract number of rows, number of columns from mtcars
.[nr, nc] <- dim(mtcars)
c(nr, nc)
# extract first, last element of vector
.[first, .., last] <- c(1, 2, 3, 4, 5)
c(first, last)
# extract a value by name
.[beta = beta] <- list(alpha = 1, beta = 2, gamma = 3)
beta
# unpack nested values
.[x, .[y, .[z]]] <- list(1, list(2, list(3)))
c(x, y, z)
# split version components
.[major, minor, patch] <- getRversion()
c(major, minor, patch)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.