wideToLong | R Documentation |
This function converts a data frame from wide format to long.
wideToLong(data, colSelections)
data |
This is the data source to be converted |
colSelections |
These are the columns (references by column number) that contain the values |
library(dplyr)
mtcars2 <- mtcars %>% mutate(Car = row.names(mtcars)) %>% select(Car,mpg,cyl,disp)
dat <- wideToLong(mtcars2,c(2:4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.