Split character vector to matrix/split columns in data.frame
split_labels
/split_columns
are auxiliary functions for
post-processing tables resulted from cro/cro_fun and etc. In
these tables all labels collapsed in the first column with "|" separator.
split_columns
split first column into multiple columns with separator
(split
argument). split_table_to_df
split first column of table
and column names. Result of this operation is data.frame with character
columns.
split_labels( x, remove_repeated = TRUE, split = "\\|", fixed = FALSE, perl = FALSE ) split_columns( data, columns = 1, remove_repeated = TRUE, split = "\\|", fixed = FALSE, perl = FALSE ) split_table_to_df( data, digits = get_expss_digits(), remove_repeated = TRUE, split = "\\|", fixed = FALSE, perl = FALSE ) make_subheadings(data, number_of_columns = 1)
x |
character vector which will be split |
remove_repeated |
logical. Default is |
split |
character vector (or object which can be coerced to such)
containing regular expression(s) (unless |
fixed |
logical. If TRUE match split exactly, otherwise use regular
expressions. Has priority over |
perl |
logical. Should Perl-compatible regexps be used? |
data |
data.frame vector which will be split |
columns |
character/numeric/logical columns in the data.frame
|
digits |
numeric. How many digits after decimal point should be left in
|
number_of_columns |
integer. Number of columns from row labels which will be used as subheadings in table. |
split_labels
returns character matrix, split_columns
returns
data.frame with columns replaced by possibly multiple columns with split
labels. split_table_to_df
returns data.frame with character columns.
data(mtcars) # apply labels mtcars = apply_labels(mtcars, cyl = "Number of cylinders", vs = "Engine", vs = c("V-engine" = 0, "Straight engine" = 1), am = "Transmission", am = c(automatic = 0, manual=1), gear = "Number of forward gears", carb = "Number of carburetors" ) # all row labels in the first column tabl = mtcars %>% calculate(cro_cpct(list(cyl, gear, carb), list(total(), vs, am))) tabl # without subheadings make_subheadings(tabl) # with subheadings split_labels(tabl[[1]]) split_labels(colnames(tabl)) # replace first column with new columns split_columns(tabl) # remove repeated split_columns(tabl, remove_repeated = FALSE) split_columns(tabl) split_table_to_df(tabl) split_table_to_df(tabl)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.