[R] Converting dataframe to matrix

Philipp Pagel p.pagel at wzw.tum.de
Fri Oct 16 11:12:11 CEST 2009


On Fri, Oct 16, 2009 at 01:55:03AM -0700, Noah Silverman wrote:
> I think  you may be correct.
> 
> I've manage to get the data into a format that the function accepts.
> 
> The error appears to be because I have negative values in my data:
> 
> Error in apply(safeNormCDF(s), 1, prod) :
>   dim(X) must have a positive length

Sounds like safeNormCDF() does not return a matrix but a vector.
What does dim(safeNormCDF(s)) say? 

> apply(1:9, 1, sum)
Error in apply(1:9, 1, sum) : dim(X) must have a positive length
> apply(matrix(1:9, nrow=3), 1, sum)
[1] 12 15 18
> apply(matrix(1:9, nrow=1), 1, sum)
[1] 45


cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/




More information about the R-help mailing list