Type: Package
Title: The Unpacking Dot Operator
Version: 0.1.0
Description: Provides a '.' object which can be used for unpacking assignments. For example, '.[rows, columns] <- dim(cars)' could be used to pull the number of rows and number of columns from 'dim(cars)' into individual variables 'rows' and 'columns' in a single step.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Suggests: codetools, testthat (≥ 3.0.0)
Config/testthat/edition: 3
URL: https://kevinushey.github.io/dotty/
NeedsCompilation: no
Packaged: 2024-08-26 18:03:11 UTC; kevin
Author: Kevin Ushey ORCID iD [aut, cre]
Maintainer: Kevin Ushey <kevinushey@gmail.com>
Repository: CRAN
Date/Publication: 2024-08-30 10:30:02 UTC

The Destructuring Dot Operator

Description

Use 'dotty' to performed destructuring assignments. Please see the examples below for usages.

Usage

.

Format

An object of class dotty of length 0.

Examples


# 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)