R/data.frame.to_matrix.R

Defines functions data.frame.to_matrix

Documented in data.frame.to_matrix

#[export]
data.frame.to_matrix <- function(x,col.names = NULL,row.names = NULL) {
	y <- .Call("Rfast_frame_to_matrix",x)
	if(is.character(col.names) && length(col.names)==ncol(y)){
		colnames(y) <- col.names
	}else if(is.logical(col.names) && col.names == TRUE){
		colnames(y) <- colnames(x)
	}
	if(is.character(row.names) && length(row.names)==nrow(y)){
		rownames(y) <- row.names
	}else if(is.logical(row.names) && row.names == TRUE){
		rownames(y) <- rownames(x)
	}
	y
}

Try the Rfast package in your browser

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

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.