[R] automatic levels

Prof Brian D Ripley ripley at stats.ox.ac.uk
Fri Apr 6 15:07:15 CEST 2001

On Fri, 6 Apr 2001, Moritz Lennert wrote:

> Hello,
> I've imported a csv, semi-colon spearated file with read.csv2,
> containing one column of rownames and one column of floating point
> numbers. When I look at the column of data with framename$columnname, I
> get the values of the column plus level values. Are these level values
> created automatically ?

Yes. It thinks the columns is not numeric.  Is read.csv2 actually
appropriate?  That is, are the numbers using `,' as the decimal separator?
Maybe you should be using read.table( , sep=";")?

> The problem is when I try to calcluate the correlation coefficient
> between this set of data and another with lm(x~y), the result indicates
> that each level seems to have been used as independent variable, making
> my results unusable.

That's not how to calculate correlation coefficients: see ?cor.

> How can I suppress the automatic creation of these levels ? Or how can I
> model with lm() without the levels interfering ?
> I've been trying to find the response in some of the manuals, but
> haven't been able to, so if someone could just point me to the right
> place...

Well, we don't know what you actually did and you supplied no examples,
but my guess is that you need to go the R Data Manual and work out how to
read your file as numbers.

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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list