[R] Odp: R code

Petr PIKAL petr.pikal at precheza.cz
Thu Dec 1 10:48:55 CET 2011


Hi
> 
> Hi everybody,
> 
> I am unable to resolve this error using the following for loop. Would
> appreciate help. The same loop works with for(i in 1:92) strangely. I
> checked the .raw input file and everything is kosher, even Line 547
> mentioned in the error message.
> 
> I wonder if there is any problem with the paste function.

I do not believe it. In that case the message will be, that R can not open 
the file.

You speak about input file but actually you are reading 93 files. Which 
one is wrong? Did you check that one? And how did you checked it?

There could be some unseen characters in this row. Without some more info 
I doubt you get any better advice.

Petr

> 
> Thanks very much in advance.
> 
> 
> **********************
> for(i in 1:93)
> {
> inputdta<- read.table(file=gsub(" ","",paste("JSR_network_[",i,"].RAW"),
> fixed=TRUE), header=TRUE)
> colnames(inputdta) <- c("jsrid","firmid","jsrstart","injsr")
> print(nrow(inputdta))
> }
> 
> ***************
> Message: Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
> na.strings, : line 547 did not have 4 elements
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/R-code-
> tp4125904p4125904.html
> Sent from the R help mailing list archive at Nabble.com.
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list