data_long | R Documentation |
'data_long()' "lengthens" data, increasing the number of rows and decreasing the number of columns. The inverse transformation is [pivot_wider()].
data_long( data, cols = "group", names_to = "name", names_prefix = NULL, names_sep = NULL, names_pattern = NULL, values_to = "value", values_drop_na = FALSE, ... )
data |
'data.frame'. The data to pivot. |
cols |
<['poor-select'][select_helpers]>. Columns to pivot into longer format. |
values_to |
'character(n)'. The name of the new column(s) that will contain the values of the pivoted variables. |
... |
Additional arguments passed on to methods. |
A 'data.frame'.
wide_data <- data.frame(replicate(5, rnorm(10))) # Customizing the names data_long( data = wide_data, cols = c(1, 2), names_to = "Column", values_to = "Numbers" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.