Hi, I've had a little problem for several weeks now. It is annoying and therefore I will ask for help now: 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 here wrong? And how can I do it better? Thanks. Laetitia
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? Thanks. Laetitia
If you are saving it to read back into R, then consider using 'save' and 'load'. It will avoid any problems that you might have when converting back and forth from the internal format to ascii data in a flat file. Also since you posted no data, there is no way we can help you solve the problem. On Sun, Apr 25, 2010 at 4:14 PM, Laetitia Schmid <laetitia.schmid@gmx.ch>wrote:> Hi, > I've had a little problem for several weeks now. It is annoying and > therefore I will ask for help now: > 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 here wrong? And how can I do it better? > > Thanks. > Laetitia > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
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: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: temporary_output.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100426/a1c32171/attachment.txt> -------------- next part -------------- Thanks. Laetitia