[R] Hey guys
    arun 
    smartpink111 at yahoo.com
       
    Mon Nov 25 20:43:03 CET 2013
    
    
  
Hi,
Try:
dat1<- t(dat[,-1]) 
 colnames(dat1) <- dat[,1]
covmat <- cov(dat1)
A.K.
I'm running into this error and I'm not sure how fix it 
Error: is.numeric(x) || is.logical(x) is not TRUE 
This is my data frame 
geneExpression_Lab10.txt
This is the homework instructions in case you want to see 
Lab10.pdf
This is my code 
dat <-read.delim("~/Dropbox/Homework/R Studio/geneExpression_Lab10.txt", header=F) 
dat <- as.matrix(dat) 
dat <- t(as.matrix(dat)) 
covmat <-cov(dat) #Error: is.numeric(x) || is.logical(x) is not TRUE 
eigvec <- eigen(covmat)$vectors 
eigval <- eigen(covmat)$values 
eigvec 
adjusted.dat <- sapply(1:ncol(dat), function(i) dat[,i]- mean(dat[,i])) 
new.dat <- adjusted.dat %*% eigvec 
plot(new.dat) 
cov(new.dat)
    
    
More information about the R-help
mailing list