R/prepdf.R

Defines functions prep.df

# Internal Function to prepare a data frame as a matrix
prep.df <- function(x,feat.names,subjects,value){

  su <- unique(x[,subjects])
  fu <- unique(x[,feat.names])
  
  ns <- length(su)
  nf <- length(fu)
  if(nrow(x) != ns*nf)
    stop("Incomplete data currently not supported.")
  
  id <- order(x[,subjects],x[,feat.names])
  
  dmat <- matrix(x[id,value],ncol=ns,nrow=nf)
  rownames(dmat) <- sort(fu)
  colnames(dmat) <- sort(su)
  dmat
}

Try the unifiedWMWqPCR package in your browser

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

unifiedWMWqPCR documentation built on Nov. 8, 2020, 6:05 p.m.