Skip to content

Tool for update

2 messages · Ronaldo Reis Jr., Andy Bunn

#
Em Sex 25 Mar 2005 11:16, abunn escreveu:
Hi,

I make a little adapt to this script and try to use.

But, when a file dont exist, the installation is aborted.

trying URL `http://cran.us.r-project.org/src/contrib/assist_0.1.2.tar.gz'
Error in download.file(url, destfile, method) :
        cannot open URL 
`http://cran.us.r-project.org/src/contrib/assist_0.1.2.tar.gz'
In addition: Warning message:
cannot open: HTTP status was `404 Not Found'

Is possible to force R to continue the installation.

Thanks
Ronaldo
--
|>   // | \\   [***********************************]
|   ( ??   ?? )  [Ronaldo Reis J??nior                ]
|>      V      [UFV/DBA-Entomologia                ]
|    /     \   [36571-000 Vi??osa - MG              ]
|>  /(.''`.)\  [Fone: 31-3899-4007                 ]
|  /(: :'  :)\ [chrysopa at insecta.ufv.br            ]
|>/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ]
|    ( `-  )   [***********************************]
|>>  _/   \_Powered by GNU/Debian Woody/Sarge
#
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:

            
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