R/list2matrix.R

Defines functions list2matrix

Documented in list2matrix

list2matrix <- function(profiles) {
	
	lengths <- sapply(profiles[["profile"]], function(x) {length(unlist(x))})
	
	stopifnot(length(unique(lengths)) == 1)
	
	mat <- matrix(unlist(lapply(profiles[["profile"]], function(x) {as.vector(unlist(x))})), ncol=length(profiles[["profile"]]))
	colnames(mat) <- names(profiles[["profile"]])
	profiles[["profile"]] <- mat
	profiles
}

Try the Starr package in your browser

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

Starr documentation built on April 28, 2020, 7:52 p.m.