Error in colMeans ... what's wrong with my data?
On Fri, 1 Apr 2005, Hartmut Weinrebe wrote:
Having searched and searched I still haven't found what's the problem with my data (I've attached the relevant file). Every time I tried to use the CANCOR-Function I got error messages. So I turned to check my two sets of variables separately by using the "colMeans"-Function. With one set no problem .. but with the other. My input :
struktur <- read.delim("struktur.csv", header=TRUE, sep = ";")
colMeans(struktur)
And the resulting error:
Error in colMeans(x, n, prod(dn), na.rm) :
`x' must be numeric
Can anyone give me a hint concerning the mistake I made?
You applied colMeans to a data frame: the help page says
x: an array of two or more dimensions, containing numeric,
complex, integer or logical values, or a numeric data frame.
One or more columns of `struktur' are not numeric. (Note that whereas an
array can be logical, a data frame must be wholly numeric.)
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595