To pivot longer for all columns in R, you can use the pivot_longer function from the tidyr package. Here's an example:
main.r519 chars23 lines
This will pivot all columns except the id column to longer format. The resulting dataframe will have three columns: id, variable, and value. The variable column will contain the original column names, and the value column will contain the corresponding values.
Alternatively, you can use the everything() function to select all columns:
main.r139 chars7 lines
However, this will also include the id column, which may not be desired. To exclude the id column, you can use the - operator:
main.r133 chars7 lines
gistlibby LogSnag