On Wed, Sep 8, 2010 at 11:29 AM, Joel <[email protected]> wrote:
>
> That is true but then I (or anyone else using the script) most know exactly
> what the name in the script is to be able to set it correctly and so on.
> Therefor it would be much better to be able to just send in the value and
> let the script handle the variable setting.
>
> But thx for the answer

 Then what you really want to do is write a _function_ that takes
arguments, and not a script. Tell your users something like:

 Do 'source("foo.R")' and then call the fnord function with your data
set: fnord(x).

Your foo.R file looks like this:

 fnord =function(x){
   print(x) # etc
 }

It's even possible to save functions to .RData files and then tell
your users to attach() them, thus not putting objects in their working
spaces.

And the next step is to write a package for your function...

Barry

______________________________________________
[email protected] 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.

Reply via email to