[R] Error: unexpected symbol in [with read.table]
Bert Gunter
bgunter.4567 at gmail.com
Fri Jun 26 20:54:44 CEST 2015
... 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.ignatius at 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.4567 at 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.ignatius at 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 at 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.
More information about the R-help
mailing list