[R] system() not accepting strings from cat()
culpritNr1
ig2ar-saf1 at yahoo.co.uk
Tue Mar 10 21:33:41 CET 2009
OH! The joy!
It worked like a sharm.
Thank you.
culpritNr1
baptiste auguie-2 wrote:
>
>
> try
> ?paste
>
>
> baptiste
>
> On 10 Mar 2009, at 20:01, ig2ar-saf1 at yahoo.co.uk wrote:
>
>>
>> Hi again R-ists,
>>
>> How do you construct a string that you can pass to system()?
>>
>> For instance. Say I do
>>
>>> system("echo Hello!")
>> Hello!
>>
>> That works. Now the alternative: I need to construct the string like
>> this
>>
>>> a <- "echo"
>>> b <- "Hello!"
>>> c <- "\n"
>>> cat(a, b, c)
>> echo Hello!
>>
>> Looks nice... but see what happens when I try to use it
>>
>>> system(cat(a, b, c))
>> echo Hello!
>> Error in system(command, intern) : non-empty character argument
>> expected
>>
>> I have googled extensively in and out of r-lists but I can't find a
>> solution.
>>
>> Can anybody help?
>>
>>
>>
>>
>> ______________________________________________
>> 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.
>
> _____________________________
>
> Baptiste Auguié
>
> School of Physics
> University of Exeter
> Stocker Road,
> Exeter, Devon,
> EX4 4QL, UK
>
> Phone: +44 1392 264187
>
> http://newton.ex.ac.uk/research/emag
>
> ______________________________________________
> 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.
>
>
--
View this message in context: http://www.nabble.com/system%28%29-not-accepting-strings-from-cat%28%29-tp22442414p22442991.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list