[R] Declare BASH Array Using R System Function

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Mon Jul 29 08:27:09 CEST 2013

You seem confused. You are programming in R, and asking questions about bash on an R mailing list. You seem to need to learn the difference between environment variables and bash variables and how processes acquire and transfer environment variables, which is really an operating system concept and off topic here. Once you do understand this difference, you might be interested in reading the R help file on Sys.setenv().
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

Dario Strbenac <dstr7320 at uni.sydney.edu.au> wrote:
>It is difficult searching for previous posts about this since the
>keywords are short and ambiguous, so I hope this is not a duplicate
>I can easily declare an array on the command line.
>$ names=(X Y)
>$ echo ${names[0]}
>I am unable to do the same from within R.
>> system("names=(X Y)")
>sh: Syntax error: "(" unexpected
>Reading the documentation for the system function, it appears to only
>be relevant for executing commands. What can I do instead to declare a
>BASH array ? Thanks.
>Dario Strbenac
>PhD Student
>University of Sydney
>Camperdown NSW 2050
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list