View source: R/basic_tbl_tools.R
| tbl_pivot_longer | R Documentation |
Title
tbl_pivot_longer( data, long_columns = NULL, numeric_groups = NULL, names_to = "feature", values_to = "value", drop_na = T, names_prefix = NULL, names_pattern = NULL, ... )
... |
library(tidyverse)
library(asbtools)
who %>% tbl_pivot_longer(
cols = new_sp_m014:newrel_f65,
names_to = c("diagnosis", "gender", "age"),
names_pattern = "new_?(.*)_(.)(.*)",
values_to = "count"
)
long_cols <- billboard %>% select(starts_with("wk")) %>% names()
billboard %>% tbl_pivot_longer(
long_columns = long_cols,
names_to = "week",
names_prefix = "wk",
values_to = "rank",
values_drop_na = TRUE
)
relig_income %>%
tbl_pivot_longer(names_to = "income", values_to = "count")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.