Revision c9833e40e7af6531f93c92bb4d2ab8a87541faad authored by Gilles Raiche on 09 December 2009, 00:00:00 UTC, committed by Gabor Csardi on 09 December 2009, 00:00:00 UTC
1 parent b6fe861
Raw File
generateStructure.r
generateStructure <-
function(var, mjc, pmjc, loadings, unique) {

 if (var/mjc != ceiling(var/mjc)) stop("Bad pmjc value")
 
 fload <- matrix(unique, ncol=mjc, nrow=var)
 
 for (i in 1:mjc) {
  if (i == 1) fload[i:(pmjc),i] <- loadings
  min <- ((i-1)*pmjc+1)
  max <- ((i-1)*pmjc+pmjc)
  if (min > dim(fload)[1]) min <- dim(fload)[1]
  if (max > dim(fload)[1]) max <- dim(fload)[1]
  if (i > 1)  fload[min:max,i] <- loadings
  if (min > dim(fload)[1]) fload[dim(fload)[1],i] <- unique
  }
  
 return(data.frame(fload))
 }
back to top