diff --git a/pkgdown.yml b/pkgdown.yml index dd5da89..3088988 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.1.11 pkgdown: 2.1.0 pkgdown_sha: ~ articles: {} -last_built: 2024-08-30T16:38Z +last_built: 2024-09-01T00:37Z urls: reference: https://kevinushey.github.io/dotty/reference article: https://kevinushey.github.io/dotty/articles diff --git a/reference/destructure.html b/reference/destructure.html new file mode 100644 index 0000000..80656bf --- /dev/null +++ b/reference/destructure.html @@ -0,0 +1,82 @@ + +Destructure an Object — destructure • dotty + Skip to contents + + +
+
+
+ +
+

`destructure` is primarily used to help define how an +object should be prepared, or transformed, prior to a +destructuring assignment. This can be relevant for +objects which have unique subsetting semantics – for +example, [numeric_version] objects.

+
+ +
+

Usage

+
destructure(object)
+
+ +
+

Details

+

Packages which would like to define special destructring +semantics for certain object classes can implement +methods for this class.

+
+ +
+ + +
+ + + + + + + diff --git a/reference/dotty.html b/reference/dotty.html index ca99676..95a6748 100644 --- a/reference/dotty.html +++ b/reference/dotty.html @@ -1,6 +1,6 @@ -The Destructuring Dot Operator — . • dottyThe Destructuring Dot Operator — . • dotty Skip to contents @@ -35,7 +35,7 @@

The Destructuring Dot Operator

-

Use `dotty` to performed destructuring assignments. +

Use `dotty` to perform destructuring assignments. Please see the examples below for usages.

diff --git a/reference/index.html b/reference/index.html index b5bcc55..899bf0e 100644 --- a/reference/index.html +++ b/reference/index.html @@ -43,6 +43,12 @@

All functionsdestructure() + + +
Destructure an Object
+
+ .
diff --git a/search.json b/search.json index b4a6601..8547239 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://kevinushey.github.io/dotty/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kevin Ushey. Author, maintainer.","code":""},{"path":"https://kevinushey.github.io/dotty/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Ushey K (2024). dotty: Unpacking Dot Operator. R package version 0.1.0.9000, https://kevinushey.github.io/dotty/.","code":"@Manual{, title = {dotty: The Unpacking Dot Operator}, author = {Kevin Ushey}, year = {2024}, note = {R package version 0.1.0.9000}, url = {https://kevinushey.github.io/dotty/}, }"},{"path":"https://kevinushey.github.io/dotty/index.html","id":"dotty","dir":"","previous_headings":"","what":"The Unpacking Dot Operator","title":"The Unpacking Dot Operator","text":"Destructuring assignments R . object.","code":""},{"path":"https://kevinushey.github.io/dotty/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"The Unpacking Dot Operator","text":"","code":"library(dotty) # extract number of rows, number of columns from mtcars .[nr, nc] <- dim(mtcars) c(nr, nc) ## [1] 32 11 # extract first, last element of vector .[first, .., last] <- c(1, 2, 3, 4, 5) c(first, last) ## [1] 1 5 # extract a value by name .[beta = beta] <- list(alpha = 1, beta = 2, gamma = 3) beta ## [1] 2 # unpack nested values .[x, .[y, .[z]]] <- list(1, list(2, list(3))) c(x, y, z) ## [1] 1 2 3 # split version components .[major, minor, patch] <- getRversion() c(major, minor, patch) ## [1] 4 4 1"},{"path":"https://kevinushey.github.io/dotty/index.html","id":"r-cmd-check","dir":"","previous_headings":"","what":"R CMD check","title":"The Unpacking Dot Operator","text":"’d like use dotty CRAN package, can avoid R CMD check warnings including file called R/zzz.R contents: function patches codetools variables usages . expressions can linted though regular bindings / assignments.","code":".onLoad <- function(libname, pkgname) { dotty::dotify() }"},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":null,"dir":"Reference","previous_headings":"","what":"The Destructuring Dot Operator — .","title":"The Destructuring Dot Operator — .","text":"Use `dotty` performed destructuring assignments. Please see examples usages.","code":""},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The Destructuring Dot Operator — .","text":"","code":"."},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"The Destructuring Dot Operator — .","text":"object class dotty length 0.","code":""},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The Destructuring Dot Operator — .","text":"","code":"# extract number of rows, number of columns from mtcars .[nr, nc] <- dim(mtcars) c(nr, nc) #> [1] 32 11 # extract first, last element of vector .[first, .., last] <- c(1, 2, 3, 4, 5) c(first, last) #> [1] 1 5 # extract a value by name .[beta = beta] <- list(alpha = 1, beta = 2, gamma = 3) beta #> [1] 2 # unpack nested values .[x, .[y, .[z]]] <- list(1, list(2, list(3))) c(x, y, z) #> [1] 1 2 3 # split version components .[major, minor, patch] <- getRversion() c(major, minor, patch) #> [1] 4 4 1"},{"path":[]},{"path":"https://kevinushey.github.io/dotty/news/index.html","id":"dotty-010","dir":"Changelog","previous_headings":"","what":"dotty 0.1.0","title":"dotty 0.1.0","text":"CRAN release: 2024-08-30 Initial CRAN release.","code":""}] +[{"path":"https://kevinushey.github.io/dotty/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kevin Ushey. Author, maintainer.","code":""},{"path":"https://kevinushey.github.io/dotty/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Ushey K (2024). dotty: Unpacking Dot Operator. R package version 0.1.0.9000, https://kevinushey.github.io/dotty/.","code":"@Manual{, title = {dotty: The Unpacking Dot Operator}, author = {Kevin Ushey}, year = {2024}, note = {R package version 0.1.0.9000}, url = {https://kevinushey.github.io/dotty/}, }"},{"path":"https://kevinushey.github.io/dotty/index.html","id":"dotty","dir":"","previous_headings":"","what":"The Unpacking Dot Operator","title":"The Unpacking Dot Operator","text":"Destructuring assignments R . object.","code":""},{"path":"https://kevinushey.github.io/dotty/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"The Unpacking Dot Operator","text":"","code":"library(dotty) # extract number of rows, number of columns from mtcars .[nr, nc] <- dim(mtcars) c(nr, nc) ## [1] 32 11 # extract first, last element of vector .[first, .., last] <- c(1, 2, 3, 4, 5) c(first, last) ## [1] 1 5 # extract a value by name .[beta = beta] <- list(alpha = 1, beta = 2, gamma = 3) beta ## [1] 2 # unpack nested values .[x, .[y, .[z]]] <- list(1, list(2, list(3))) c(x, y, z) ## [1] 1 2 3 # split version components .[major, minor, patch] <- getRversion() c(major, minor, patch) ## [1] 4 4 1"},{"path":"https://kevinushey.github.io/dotty/index.html","id":"r-cmd-check","dir":"","previous_headings":"","what":"R CMD check","title":"The Unpacking Dot Operator","text":"’d like use dotty CRAN package, can avoid R CMD check warnings including file called R/zzz.R contents: function patches codetools variables usages . expressions can linted though regular bindings / assignments.","code":".onLoad <- function(libname, pkgname) { dotty::dotify() }"},{"path":"https://kevinushey.github.io/dotty/reference/destructure.html","id":null,"dir":"Reference","previous_headings":"","what":"Destructure an Object — destructure","title":"Destructure an Object — destructure","text":"`destructure` primarily used help define object prepared, transformed, prior destructuring assignment. can relevant objects unique subsetting semantics – example, [numeric_version] objects.","code":""},{"path":"https://kevinushey.github.io/dotty/reference/destructure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Destructure an Object — destructure","text":"","code":"destructure(object)"},{"path":"https://kevinushey.github.io/dotty/reference/destructure.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Destructure an Object — destructure","text":"Packages like define special destructring semantics certain object classes can implement methods class.","code":""},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":null,"dir":"Reference","previous_headings":"","what":"The Destructuring Dot Operator — .","title":"The Destructuring Dot Operator — .","text":"Use `dotty` perform destructuring assignments. Please see examples usages.","code":""},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The Destructuring Dot Operator — .","text":"","code":"."},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"The Destructuring Dot Operator — .","text":"object class dotty length 0.","code":""},{"path":"https://kevinushey.github.io/dotty/reference/dotty.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The Destructuring Dot Operator — .","text":"","code":"# extract number of rows, number of columns from mtcars .[nr, nc] <- dim(mtcars) c(nr, nc) #> [1] 32 11 # extract first, last element of vector .[first, .., last] <- c(1, 2, 3, 4, 5) c(first, last) #> [1] 1 5 # extract a value by name .[beta = beta] <- list(alpha = 1, beta = 2, gamma = 3) beta #> [1] 2 # unpack nested values .[x, .[y, .[z]]] <- list(1, list(2, list(3))) c(x, y, z) #> [1] 1 2 3 # split version components .[major, minor, patch] <- getRversion() c(major, minor, patch) #> [1] 4 4 1"},{"path":[]},{"path":"https://kevinushey.github.io/dotty/news/index.html","id":"dotty-010","dir":"Changelog","previous_headings":"","what":"dotty 0.1.0","title":"dotty 0.1.0","text":"CRAN release: 2024-08-30 Initial CRAN release.","code":""}] diff --git a/sitemap.xml b/sitemap.xml index 6af2264..a7420c2 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,6 +4,7 @@ https://kevinushey.github.io/dotty/authors.html https://kevinushey.github.io/dotty/index.html https://kevinushey.github.io/dotty/news/index.html +https://kevinushey.github.io/dotty/reference/destructure.html https://kevinushey.github.io/dotty/reference/dotty.html https://kevinushey.github.io/dotty/reference/index.html