Re: [R] Problem Reading from .txt

From: chao gai <>
Date: Thu 19 Oct 2006 - 17:12:11 GMT


It looks like you are having from some source a hard return in your string. When that hard return is in the middle of a number, R sees this as two numbers, not separated by a comma (,) and throws an error. Like this:
> c(13,12

+ .3)
Error: syntax error in:
When the hard return is next to a comma (,) it is valid R, so it passes. In your case it might be around 990th character that the hard occurs.

However, the txt file you added had some additional hard returns so my observations might be wrong.


On Thursday 19 October 2006 15:06, Bill Wyatt wrote:
> I apologize that I've asked a similar question before, but being new to
> R I don't think I did a very good job of formating the question.
> I've included a text file since the date set is somewhat large.
> What I have is a huge string of numbers in a text file. The numbers are
> all separated by comma's and the groups are separated by a semicolon.
> What I would like to do is read each group in as a single column.
> I had hoped that I could just do something like
> a<-cbind(c("big string of numbers"))
> However I receive several syntax errors when I do that.
> Included in the text document are two lines that represent the first
> point that error occurs in the included data set.
> If I run line one it works. Line two is identical I just selected one
> more number from the data set and it will not work.
> If anyone could tell me why this is happening, and possibly some way to
> read these large strings into a single column I would be grateful.
> --------------------------------------------------------------------
> Bill Wyatt
> Associate Instructor
> Ergonomics Graduate Student
> Department of Kinesiology
> School of Health, Physical Education, and Recreation
> Indiana University
> O:(812)856-5924
> -------------------------------------------------------------------- mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri Oct 20 12:23:05 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 20 Oct 2006 - 03:30:11 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.