# NOT RUN {
## Example 1:
stocks = data.frame(
time = as.Date('2009-01-01') + 0:9,
X = rnorm(10, 0, 1),
Y = rnorm(10, 0, 2),
Z = rnorm(10, 0, 4)
)
stocks
stocks %>%
longer_dt(time)
stocks %>%
longer_dt("ti")
# Example 2:
# }
# NOT RUN {
library(tidyr)
billboard %>%
longer_dt(
"wk",
gathered_name = "week",
gathered_value = "rank",
na.rm = TRUE,negate = TRUE
)
# or use:
billboard %>%
longer_dt(
artist,track,date.entered,
gathered_name = "week",
gathered_value = "rank",
na.rm = TRUE,negate = TRUE
)
# or use:
billboard %>%
longer_dt(
group_to_keep = 1:3,
gathered_name = "week",
gathered_value = "rank",
na.rm = TRUE,negate = TRUE
)
# }
Run the code above in your browser using DataLab