Hi Fellow R enthusiasts I have managed to reshape my data using a much shorter script than before. Woohoo However now I have new problems. The code is below. There are no problems with the create matrix section. The problem code is highlighted in bold. I am trying to do PCA on the data. Here are the errors.
Error1 code : OGSscaled = rangescale(OGS) error message : Error in dim(newX) <- c(prod(d.call), d2) : dims [product 47960] do not match the length of object [43600] Error2 I tried to do PCA without rangescaling code :OGSpca <- prcomp(OGS, center=FALSE) error message : Error in svd(x, nu = 0) : infinite or missing values in 'x' CODE ###################################################### ########### Create matrix ########################### ###################################################### # load packages require(reshape) source("rangescale.r") #Open the csv file OGSdata <- read.table("MG3199.csv",sep=",",header=TRUE) #create matrix x.m <- melt(OGSdata, measure.var="pct") OGS <- cast(x.m, mci ~ sample) ###################################################### ########### PCA #################################### ###################################################### #scale profiles OGSscaled = rangescale(OGS) #do PCA result = prcomp(OGS, center=FALSE) #obtain scores matrix scores=result$rotation #PC1 vs PC2 plot plot(scores[,1], scores[,2], xlab="PC1", ylab="PC2") #add labels (0.005 and 0.003 offset to aviod obscuring points Kind Regards Amit Patel ___________________________________________________________ now. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.