Hi Kate, I could well be wrong, but are you sure that your data file is TAB delimited and not whitespace delimited?
Jim On Sat, Jun 27, 2015 at 7:37 AM, MacQueen, Don <macque...@llnl.gov> wrote: > If > > a <- read.table(args[1],sep="\t",header=T, stringsAsFactors=F) > > > fails but > > a <- read.table("/path/to/file/filename.txt", header=T,sep="\t", > stringsAsFactors=F) > > > succeeds, then since those two commands are otherwise identical, you had > better put > > print(args[1]) > > before the call to read.table, to find out if it is actually what you > think it is. > > Also, obviously, the argument(s) that you supply after > /path/to/R/R-3.0.2/bin/Rscript > are relevant. > > -Don > > -- > Don MacQueen > > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > > > > > > On 6/26/15, 12:48 PM, "R-help on behalf of Kate Ignatius" > <r-help-boun...@r-project.org on behalf of kate.ignat...@gmail.com> wrote: > >>Oops - error on my part. Sorry. >> >>On Fri, Jun 26, 2015 at 2:54 PM, Bert Gunter <bgunter.4...@gmail.com> >>wrote: >>> ... and you should also know by now to cc the list and not respond just >>>to me! >>> Bert Gunter >>> >>> "Data is not information. Information is not knowledge. And knowledge >>> is certainly not wisdom." >>> -- Clifford Stoll >>> >>> >>> On Fri, Jun 26, 2015 at 10:58 AM, Kate Ignatius >>><kate.ignat...@gmail.com> wrote: >>>> "reading in a tab delimited file using args" >>>> >>>> What I mean by that is that I'm using a bash script to call in an R >>>> script and using the command: args <- commandArgs(TRUE) in my R >>>> script. >>>> >>>> In my shell script I'm calling the R program as follows: >>>> /path/to/R/R-3.0.2/bin/Rscript >>>> >>>> I'm not sure if that will help - sure you will all know if it doesn't. >>>> >>>> K. >>>> >>>> On Fri, Jun 26, 2015 at 1:39 PM, Bert Gunter <bgunter.4...@gmail.com> >>>>wrote: >>>>> ?? >>>>> Are you expecting us to guess what your code was from >>>>> >>>>> "reading in a tab delimited file using args" ? >>>>> >>>>> You've posted here before and should know by now that explicit code >>>>> should be provided whenever possible. >>>>> >>>>> >>>>> Cheers, >>>>> Bert >>>>> Bert Gunter >>>>> >>>>> "Data is not information. Information is not knowledge. And knowledge >>>>> is certainly not wisdom." >>>>> -- Clifford Stoll >>>>> >>>>> >>>>> On Fri, Jun 26, 2015 at 10:32 AM, Kate Ignatius >>>>><kate.ignat...@gmail.com> wrote: >>>>>> When reading in a tab delimited file using args I keep getting the >>>>>>error: >>>>>> >>>>>> Error: unexpected symbol in "Name index" >>>>>> >>>>>> Execution halted >>>>>> >>>>>> The code is this: >>>>>> >>>>>> a <- read.table(args[1],sep="\t",header=T, stringsAsFactors=F) >>>>>> >>>>>> When inputting the file directly, as follows, this produces no >>>>>>errors: >>>>>> >>>>>> a <- read.table("/path/to/file/filename.txt", header=T,sep="\t", >>>>>> stringsAsFactors=F). >>>>>> >>>>>> The file is such: >>>>>> >>>>>> Name index >>>>>> Bob 1 >>>>>> George 2 >>>>>> Dave 3 >>>>>> Eric 4 >>>>>> . >>>>>> . >>>>>> . >>>>>> . >>>>>> Andrew 20 >>>>>> >>>>>> Is there anything I should be looking out for that might be producing >>>>>> this error. Any help will be greatly appreciated. >>>>>> >>>>>> ______________________________________________ >>>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>>>> 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. >> >>______________________________________________ >>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>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. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.