[R] difference in behavior between batch and source

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jun 4 02:15:04 CEST 2006


nm <- c("a", "b", "c")
nm <- c(nm, "d", "e", "f")
read.table("myfile.dat", col.names = nm)

or paste the column names into the first line of the data file
using a text editor and use:

read.table("myfile.dat", header = TRUE)

On 6/3/06, markleeds at verizon.net <markleeds at verizon.net> wrote:
> Hi : I am using R 2.20 on windows XP and I have a REALLY
> long read.table statement because the col.names argument
> has 440 character strings in it. ( I use python to write R code ).
> When I run the read.table statement inside an R program
> ( the R program only consists of the read.table statement )
> using the source command in an interactive R session,
> everything works fine. But, if I take the same program
> and try to run it using R CMD BATCH program name ,
> the .Rout file shows me that the execution gets halted at
> one of the col.names arguments but there is no error message.
> it just says "execution halted".
> So, I am thinking that this may have to do with some limit
> in R for how long the col.names argument can be ( or
> any command for that matter ) ? But, the same program works using the source command and I would think that the source command
> still has to read theline in somewhere  ?
> What makes me think even more that the problem has something to
> do with the length of the command is that, as a test,
> I took the tread.table command and copied and pasted it into
> an interactive session to see if it would run that way.
> What was interesting was that the whole command did not get pasted and the pasting stopped at exactly the same place that the .Rout file showed that it stopped during BATCH mode.
> I can't send the command right now because I don't have email at
> the location where I am working but I may be able
> to send it later ? Any thoughts, suggestions or solutions
> would be really appreciated because I need to be able
> to get this program to work using BATCH mode.
>                                      Thanks a lot.
> ______________________________________________
> R-help at 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

More information about the R-help mailing list