[R] R: passing parameters to an R script

jim holtman jholtman at gmail.com
Sun Jan 4 02:51:00 CET 2009


?commandArgs

On Sat, Jan 3, 2009 at 4:17 PM,  <mauede at alice.it> wrote:
> Thank you.
> You're right. I come from C and C++ programming.
> I wonder whether to pass parameters to an R script I have to set environment
> variables ... ?
>
> Best regards,
> Maura
>
>
> -----Messaggio originale-----
> Da: jim holtman [mailto:jholtman at gmail.com]
> Inviato: sab 03/01/2009 21.12
> A: mauede at alice.it
> Cc: r-help at stat.math.ethz.ch; r-help at r-project.org
> Oggetto: Re: [R] passing parameters to an R script
>
> No you can not pass an address to a function.  If you want to change
> the value of something, then return it as a value and assign it to the
> object so you can see what is going on.  Must be coming from the "C"
> environment where such things are allowed and lead to a number of
> problems.
>
> If you really have your heart set to do it, look at the '<<-' operator
> (or 'assign'), but use it with care.
>
> To retrieve environment values, use "Sys.getenv".
>
> On Sat, Jan 3, 2009 at 1:32 PM,  <mauede at alice.it> wrote:
>> I knowf R functions ca be called passing some parameters.
>> My first question is: how are parameters passed to R functions ?
>> Browsing through R archives I found an answer confirming taht parameters
>> can
>> be passed to the  called function by value. I wonder whether passing the
>> parameter
>> address is possible somehow to allow the function to actually change its
>> value.
>>
>> My second question is about running R scripts with parameters. Something
>> similar to the
>> s/w device (argc, argv) which is used to run a C program with initial
>> parameters.
>> Is this possible at all ?
>>
>> Thank you very much.
>> Maura
>>
>>
>>
>> tutti i telefonini TIM!
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>
>
>
> Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e
> tutti i telefonini TIM!
> Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list