Description Usage Arguments Details Value See Also Examples
This function transposes tables containing numeric and categorical data using the tidyr package.
1 2 | transposer(.data, ids = NULL, header_name, preserved_categories = TRUE,
separated_categories = NULL)
|
.data |
A matrix/data_frame/tibble for transposing. |
ids |
The column to transpose by. Default: The first column. |
header_name |
A name for the numeric data that will be transposed. |
preserved_categories |
A logical denoting weather categorical data should be conserved. A value of FALSE will cause all categorical data except the ids to be dropped. A value of TRUE will cause the categorical data to preserved by tidyr::uniteing these columns. Default: TRUE |
separated_categories |
A vector containing ordered column names to use in a previously transposed and categorically preserved table. Retransposing with this set should yield an exact replicate of the original data. Default: NULL |
Transposing can help with preforming operations on the rows of your tibbles.
A transposed data table as a tibble.
select_all
, select
, reexports
, sym
, one_of
gather
, unite
, spread
, separate
Other Data Manipulators: convert_proportions
,
metacoder_comp_func_1
,
transformer
, vlookup
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
if(interactive()){
# This example uses data that are no longer available in the MicrobiomeR package,
# however, they can be easily generated with \code{\link{MicrobiomeR}{as_basic_format}}.
library(MicrobiomeR)
basic_silva <- as_MicrobiomeR_format(MicrobiomeR::raw_silva_2, "basic_format")
data <- basic_silva$data$taxa_abundance
trans_data <- data %>%
transposer(ids = "taxon_id", header_name = "samples")
retrans_data <- trans_data %>%
transposer(ids="samples", header_name="taxon_id")
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.