[R] Error in inherits(x, "data.frame") : subscript out of bounds
kloytyno at mappi.helsinki.fi
kloytyno at mappi.helsinki.fi
Fri Mar 5 15:24:24 CET 2010
Hi,
I have a list p with different size dataframes and length of over
8000. I'm trying to
calculate correlations between the rows of dataframes of this list and
columns of another
dataset (type data.frame also) so that first column is correlated with
all the rows in
the list dataframe. Some information from another dataset is also
included to the final
output (all.corrs). This worked a couple of weeks ago when I wrote it
but now it seems
not to, and gives an error message:
Error in inherits(x, "data.frame") : subscript out of bounds
In addition: There were 50 or more warnings (use warnings() to see the
first 50)
warnings()
Warning messages: 1: In corrs[j] <- cbind(expressions[j, 1:5], SNP.expr.cor) :
number of items to replace is not a multiple of replacement length
which indicates that the problem is with getting correlation and other
information into
corrs. cbind(expressions[j,1:5], SNP.expr.cor) is type data.frame.
Changing corrs into
matrix, dataframe, list or any other type has not helped.
I've updated R from 2.9.0 to the recent version in between. Would
anyone have a solution
for this problem? I very much appreciate all help.
SNP.expr.cor<-NULL
all.corrs<-NULL
corrs<-NULL
for(i in 1:length(p)){
dim.exp<-dim(p[[i]])
expressions<-p[[i]]
expressions.m<-as.matrix(expressions[,6:48])
for(j in
1:dim.exp[1]){
SNP.expr.cor<-cor(genotypes[,i],expressions.m[j,],use="na.or.complete")
corrs[j]<-cbind(expressions[j,1:5], SNP.expr.cor)
}
all.corrs[i]<-list(cbind(map[i,1:6], corrs))
}
BR
Katja
--
Katja Löytynoja, FM
Haartman Institute
Department of Medical Genetics
Biomedicum Helsinki
P.O.Box 63
FIN-00014 University of Helsinki
tel +358-9-19125496
gsm +358-50-4000324
fax +358-9-19125624
e-mail katja.loytynoja at helsinki.fi
More information about the R-help
mailing list