[R] Re: automatic updating
Andy Bunn
abunn at whrc.org
Tue Apr 19 16:27:04 CEST 2005
The Tuesday update script came back to get me! I knew it would.
update.packages has changed (for the better) with this release. Look at the
NEWS file:
The 'CRAN' argument to update.packages(), old.packages(),
new.packages(), download.packages() and install.packages() is
deprecated in favour of 'repos',
and...
There is a new possible value update.packages(ask="graphics")
and...
update.packages() and old.packages() have a new option
'checkBuilt' to allow packages installed under earlier
versions of R to be updated
So, if you want to keep updating on Tuesdays, despite sensible advice to the
contrary offered in this thread
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48390.html
you'll hvae to change the script to something like this:
# Run this once a week - say Tuesdays
if (interactive() ) { library(utils)}
is.tuesday <- as.POSIXlt(Sys.time())$wday == 2
if (is.tuesday == T)
{
cat("Running a package check...\nOccurs once a week, on Tuesdays\n")
cat("Upgrade existing packages and check for new packages (y/N)? ")
check.new <- as.character(readLines(n = 1))
if (any(check.new == "y", check.new == "Y"))
{
cat("This can take a few seconds...\n")
update.packages(ask=FALSE)
}
}
But, you should change this to a chron job.
HTH, Andy
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of
> r.ghezzo at staff.mcgill.ca
> Sent: Tuesday, April 19, 2005 9:57 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Re: automatic updating
>
>
> Hello,
> Running R 2.1.0 in a Win XP
> I put the snipped to automatically update my libraries on
> Tuesdays that was
> presented to the list some time back, It worked with no problem
> for R 2.0.1 but
> now that I installed R 2.1.0 and copy the old Rprofile to the new
> r/etc I get
> an error.
> This is my Rprofile:
> - - - - - - - - - - - - - - - - - - - -
> # Things you might want to change
>
> # options(papersize="a4")
> # options(editor="notepad")
> # options(pager="internal")
>
> # to prefer Compiled HTML help
> options(chmhelp=TRUE)
>
> # to prefer HTML help
> # options(htmlhelp=TRUE)
>
> # to prefer Windows help
> # options(winhelp=TRUE)
>
> .libPaths(c("c:/r/r_cran/library","c:/r/r_src/library",
> "c:/r/r_jl/library","c:/r/r_bdr/library",
> "c:/r/r_bio/library"))
> #
> # This script gets all the packages I don't already have
> # Run this once a week - say Tuesdays
> #
> if (interactive() ) { library(utils)}
> is.tuesday <- as.POSIXlt(Sys.time())$wday == 2
> if (is.tuesday == T)
> {
> cat("Running a package check...\nOccurs once a week, on Tuesdays\n")
> cat("Upgrade existing packages and check for new packages (y/N)? ")
> check.new <- as.character(readLines(n = 1))
> if (any(check.new == "y", check.new == "Y"))
> {
> options(CRAN = "http://cran.us.r-project.org/")
> cat("This can take a few seconds...\n")
> x <- packageStatus(repositories =
> getOption("repositories")()[[1]])
> print(x)
> install.packages(x$avail$Package[x$avail$Status == "not
> installed"])
> cat("Upgrading to new versions if available\n")
> upgrade(x)
> }
> }
> #
> - - - - - - - - - - - - -
> when I start R 2.1.0 I get:
>
> R : Copyright 2005
> ....
> Type 'q()' to quit R
>
> Running a package check...
> Occurs once a week, on Tuesdays
> Upgrade existing packages and check for new packages (y/N)? y
> This can take a few seconds...
> Error in packageStatus(repositories = getOption("repositories")()[[1]]) :
> attempt to apply non-function
>
> Where do I have to modify the snippet so it works with R 2.1, it
> was perfect for
> 2.0.1
> Thanks for any help
>
> Heberto Ghezzo
> McGill University
> Montreal - Canada
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list