[R] R Error, very odd....

Dieter Menne dieter.menne at menne-biomed.de
Mon May 11 09:46:35 CEST 2009

Katie2009 wrote:
> hi dieter,
> the method i'm using is in excel, copying the data, then in r
>> w<-read.delim("clipboard")
>> w<-as.data.frame(w)
> i've been  doing a bit more fiddling, and have identified the 'class' of
> the column that i'm having trouble with, is classified as 'factor' whilst
> the rest are numeric.

read.delim internally uses the same function as read.table, so you might
consult that documentation:

The number of data columns is determined by looking at the first five lines
of input (or the whole file if it has less than five lines), or from the
length of col.names if it is specified and is longer. This could conceivably
be wrong if fill or blank.lines.skip are true, so specify col.names if

So if the first lines are unusual, many things can happen. However, reading
from the clipboard
is not a very stable way to get Excel data; I would suggest to use
library(RODBC) instead,
or one of the other Excel readers. With RODBC, use named ranges, not
worksheet names
for a stable import.


View this message in context: http://www.nabble.com/R-Error%2C-very-odd....-tp23477195p23478576.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list