papaja icon indicating copy to clipboard operation
papaja copied to clipboard

Add a split_by option to apa_table()

Open crsh opened this issue 6 years ago • 0 comments

apa_table() can combine lists of data.frame. It's simple to use a column to split a data.frame, to turn one column into table spanners or stub intents using split. It may be worth to add this as an option to apa_table() for convenience.

It should be as simple as adding something like the following to apa_table.data.frame():

if(!is.null(split_by) && split_by %in% colnames(x)) {
  x <- lapply(split(x, f = x[[split_by]]), function(x) x[, -1])
  apa_table.list(x)
}

crsh avatar Feb 07 '20 09:02 crsh