[R] Re: automatic updating

r.ghezzo@staff.mcgill.ca r.ghezzo at staff.mcgill.ca
Tue Apr 19 15:56:51 CEST 2005


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




More information about the R-help mailing list