R/f.matrix.to.list.R

Defines functions f.matrix.to.list

f.matrix.to.list <- function(x){
# CONVERTS A MATRIX x TO A LIST WHERE EACH COLUMN IS ONE ELEMENT OF THE
# LIST
#
	if(!(is.matrix(x) | is.data.frame(x))) stop("Object must be a matrix!")
	lapply(seq(dim(x)[2]), function(i, .mat) .mat[,i], .mat = x)

}

Try the Haplin package in your browser

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

Haplin documentation built on Sept. 11, 2024, 7:13 p.m.