Re: [R] Problem Reading from .txt

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

Bill,

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:
"c(13,12
.3"
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.

Kees

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
> wwyatt@indiana.edu
> --------------------------------------------------------------------



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.