R/df2lmFit.R

Defines functions df2lmFit

Documented in df2lmFit

df2lmFit = function(df){
  if(!"residuals"%in%colnames(df))
    stop("no residuals, need to estimate main effects and update dataframe")
  df = df[df$Type=="comb",]
  df = df[!is.na(df$residuals),]
  
  ta = table(df$Pair)
  maxrep=max(ta)
  
  m = matrix(NA_real_,
    nrow = nlevels(as.factor(df$Pair)),
    ncol = maxrep,
    dimnames = list(levels(as.factor(df$Pair)),1:maxrep))

  for (j in rownames(m))
    m[j,1:length(df$residuals[which(df$Pair==j)])]=df$residuals[which(df$Pair==j)]
  fit = lmFit(m)
  fit
}
 
  

Try the coRNAi package in your browser

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

coRNAi documentation built on Nov. 17, 2017, 11:14 a.m.