Defines functions sep.factor.row

Documented in sep.factor.row

#'@title A function to seperate a matrix, by row, into submatrices.
#'@usage sep.factor.row (x,factor)
#'@description separate matrix by rows into submatrices
#'@param x a matrix.
#'@param factor a factor of the same length as the number of row in the matrix.
#'@return list of submatrices
sep.factor.row <- function(x,factor){
  s <- list()
  F1 <- factor
  N <- length(levels(factor))
  levels(factor) <- 1:N
  for(i in 1:N){
    s[[i]] <- m[factor==i,]
  names(s) <- levels(F1)

Try the subniche package in your browser

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

subniche documentation built on July 7, 2017, 5:02 p.m.