John Lawrence Aspden wrote:
I've got a library (brainwaver), installed locally in ~/R/library, and
this information is recorded in the ~/.Renviron file.
In my script I load the library, but if I call it using
#!/usr/bin/r --vanilla, this stops working.
(Various private e-mails exchanged.
[By now way off the subject line. Something like 'how to set the
libraries inside an R session'.]
On Wed, 10 Jan 2007, John Lawrence Aspden wrote:
John Lawrence Aspden wrote:
I've got a library (brainwaver), installed locally in ~/R/library, and
this information is recorded in the
Brian Ripley wrote:
Exactly as documented. The argument is named 'new' and not 'add', BTW.
Please 'be careful' in what you say about the work of others.
Agreed, no criticism intended. I really like R. Sorry.
Cheers, John.
--
Contractor in Cambridge UK -- http://www.aspden.com
Guys, thanks very much for your help. Rscript looks great and I'll look
forward to it.
The /usr/bin/env thing seems to be a general difficulty with the mechanism.
One's first thought has to be to modify env to parse and then pass the
arguments in the expected way (maybe #!/usr/bin/env2?), and of
John Lawrence Aspden wrote:
I'm actually tempted to use
#!/usr/bin/env r
rm(list=ls())
Ahem, it turns out to be better to use:
#!/usr/bin/env r
rm(list=ls()[ls()!=argv])
--
Contractor in Cambridge UK -- http://www.aspden.com
__
John Lawrence Aspden wrote:
John Lawrence Aspden wrote:
I'm actually tempted to use
#!/usr/bin/env r
rm(list=ls())
Ahem, it turns out to be better to use:
#!/usr/bin/env r
rm(list=ls()[ls()!=argv])
Eww!! I'm not sure you want to do that. I would recommend sticking with:
Jeffrey Horner wrote:
John Lawrence Aspden wrote:
I'm actually tempted to use
#!/usr/bin/env r
rm(list=ls()[ls()!=argv])
Eww!! I'm not sure you want to do that. I would recommend sticking with:
#!/usr/bin/r -v
as that gives you a truer scripting environment. I understand that
Hi,
I'm trying to write R scripts using littler (under Debian), and was
originally using the shebang line:
#!/usr/bin/env r
However this picks up any .RData file that happens to be lying around, which
I find a little disturbing, because it means that the script may not behave
the same way
Hi (again),
Another difficulty I'm having is creating a common function (foo, say) to
share between two scripts.
I've tried making a third file containing the function and then sourcing it
with source (foo.R), but that only works if you run the script in the
directory where foo.R is. (or if the
[John Lawrence Aspden]
I'm trying to write R scripts using littler (under Debian), and was
originally using the shebang line:
#!/usr/bin/env r
However this picks up any .RData file that happens to be lying around, which
I find a little disturbing, because it means that the script may not behave
[John Lawrence Aspden]
Another difficulty I'm having is creating a common function (foo, say) to
share between two scripts.
In your previous message, you were telling us that you want to load from
your home directory. You might put the common functions there, maybe?
--
François Pinard
Thanks, that's a really neat mechanism, ( I especially like the note to vim,
which will save all my scripts having to end .R )
Is there any way to get at the command line and stdio though?
With littler I can do things like:
#!/usr/bin/env r
print(argv)
t=read.table(file=stdin())
so that I can
François Pinard wrote:
[John Lawrence Aspden]
Another difficulty I'm having is creating a common function (foo, say) to
share between two scripts.
In your previous message, you were telling us that you want to load from
your home directory. You might put the common functions there, maybe?
Looks like it will be possible to write scripts with R 2.5.0 using the
new -f flag and file(stdin). From https://svn.r-project.org/R/trunk/NEWS :
o Command-line R (and Rterm.exe under Windows) accepts the options
'-f filename', '--file=filename' and '-e expression' to follow
He missed
o There is a new front-end Rscript which can be used for #!
scripts and similar tasks. See help(Rscript) and 'An
Introduction to R' for further details.
and that is needed for #! scripts. (You cannot write #!/path/to/R -f as R
is a shell script and so
15 matches
Mail list logo