| capture_longer_spec | R Documentation | 
Create a spec data table for input to pivot_longer_spec.
capture_longer_spec(data, 
    ..., values_to = "value")| data | Data table to reshape (actually the  | 
| ... | Regex and conversion as described in  | 
| values_to | string to use for name of value column in output (only used if
there is a single output column in the reshaped  | 
data table describing a reshape longer operation.
Toby Hocking <toby.hocking@r-project.org> [aut, cre]
(one.iris <- iris[1,])
(single.spec <- nc::capture_longer_spec(iris, part=".*", "[.]", dim=".*", values_to="cm"))
(multiple.spec <- nc::capture_longer_spec(iris, part=".*", "[.]", column=".*"))
if(requireNamespace("tidyr")){
  tidyr::pivot_longer_spec(one.iris, single.spec)
  tidyr::pivot_longer_spec(one.iris, multiple.spec)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.