[R] numerical or not?

Sarah Goslee sarah.goslee at gmail.com
Mon Apr 26 23:28:57 CEST 2010


I tried reading in your text file with the read.table statement
you provided. Everything worked fine for me - str() shows that
all values are integers, and functions such as summary()
work as anticipated.

You don't tell us *what* you are trying to do. One possible source
of error is that read.table() creates a dataframe - a list, not a matrix.
You can convert dat1
dat1 <- as.matrix(dat1)
and that might work better for your (unspecified) purposes.

If that doesn't help, providing a *working* example of what you
are doing will get you the most effective answers.

Sarah

2010/4/26 Laetitia Schmid <laetitia at gmt.su.se>:
> Hi,
> I've had a little problem for several weeks now. It is annoying and
> therefore I will ask for help:
> When I write a script with several iterations, I make it write out a
> text file to save the data during the run. For example I write:
> if (i %% 25) write.table(output,"temporary_output.txt")
> Later on, when I read in this output and want to calculate things, R
> complains that x is not numeric.
> I read it in with the following command:
> dat1<-read.table("temporary_output.txt",header=TRUE).
> It seems that R is saving my temporary output as a list.
> What is wrong here? And how can I do it better?
>
> This time I attached the temporary_output.txt:
>
>
>




-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list