R/rbind.r

#' rbind
#'
#' Concatenate multiple phyDat objects
#'
#' @param ... a list of phyDat objects
#' @param deparse.level see definition in generic rbind
#'
#' @return a phyDat object
#'
#' @export
#'
setMethod(
	'rbind',
	signature(
		... = 'phyDat'
	),
	function(
		...,
		deparse.level = 1
	){

		# need to make sure that the levels of each phyDat are the same
		x <- list(...)
		lv <- levels(x[[1]])
		do.call('rbind', lapply(x, as.character)) %>% phyDat(type = 'USER', levels = lv)

	}
) # rbind

Try the DCLEAR package in your browser

Any scripts or data that you put into this service are public.

DCLEAR documentation built on Sept. 14, 2023, 9:09 a.m.