parallel_gather | R Documentation |
Essentially this is a wrapper around gather that is able to bind_cols with several gather operations. This is useful when a wide data frame contains uncertainty or flag information in paired columns.
parallel_gather(x, key, ..., convert = FALSE, factor_key = FALSE)
x |
A data.frame |
key |
Column name to use to store variables, which are the column names of the first gather operation. |
... |
Named arguments in the form |
convert |
Convert types (see gather) |
factor_key |
Control whether the key column is a factor or character vector. |
A gathered data frame.
gather
# gather paired value/error columns using # parallel_gather parallel_gather(pocmajsum, key = "param", value = c(Ca, Ti, V), sd = c(Ca_sd, Ti_sd, V_sd) ) # identical result using only tidyverse functions library(dplyr) library(tidyr) gathered_values <- pocmajsum %>% select(core, depth, Ca, Ti, V) %>% gather(Ca, Ti, V, key = "param", value = "value" ) gathered_sds <- pocmajsum %>% select(core, depth, Ca_sd, Ti_sd, V_sd) %>% gather(Ca_sd, Ti_sd, V_sd, key = "param_sd", value = "sd" ) bind_cols( gathered_values, gathered_sds %>% select(sd) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.