RE: [R] Tool for update

From: Andy Bunn <abunn_at_whrc.org>
Date: Sat 23 Apr 2005 - 03:52:27 EST


Hi Ronaldo: First, this script was discussed a few days ago. Note that under 2.1 update.packages() has changed for the better. Look at the NEWS file.

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 have 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)

   }
}

Second, you wrote:

> I make a little adapt to this script and try to use.
>
> But, when a file dont exist, the installation is aborted.

If you really need to automate this and use download.file then look at using try() to catch errors. I suggest you look at the file structure of the src/contrib folder at CRAN and modify your code if you need to. For instance, point to src/contrib/assist_1.0.tar.gz and not assist_0.1.2.tar.gz as the source version is now 1.0 for assist.

But, as mentioned earlier, it would be better to move this all to a chron job.

HTH, Andy



R-help@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 Received on Sat Apr 23 03:57:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:22 EST