Examples for 'iNZightTools::stackVars'


Stack variables

Aliases: stackVars

Keywords:

### ** Examples

stacked <- stackVars(iris, vars = c("Species", "Sepal.Width"),
    key = "Variable", value = "Value")
Warning: attributes are not identical across measure variables;
they will be dropped
cat(code(stacked))
iris %>% tidyr::gather(key = "Variable", value = "Value", Species,      Sepal.Width)
head(stacked)
  Sepal.Length Petal.Length Petal.Width Variable  Value
1          5.1          1.4         0.2  Species setosa
2          4.9          1.4         0.2  Species setosa
3          4.7          1.3         0.2  Species setosa
4          4.6          1.5         0.2  Species setosa
5          5.0          1.4         0.2  Species setosa
6          5.4          1.7         0.4  Species setosa

[Package iNZightTools version 1.12.2 Index]