swh:1:snp:4727dd88296eeb5e206bc989261ce6807dec4b3f
Tip revision: 3dba8ca45cd3f599b17f270b8eea3c037b0f463e authored by David R. Hunter on 16 July 2012, 00:00:00 UTC
version 3.0-1
version 3.0-1
Tip revision: 3dba8ca
update_statnet.R
# NB: Package names can contain numbers but no statnet packages
# currently do. The regexps used in the two strsplit calls
# below would need to be modified if they did.
update_statnet <- function(...) {
# Extract the names of the packages to update. First, the
# packages in the Depends line of statnet/DESCRIPTION:
message("Checking for newer versions of statnet and these other required packages:")
a <- packageDescription("statnet", fields="Depends")
b <- unlist( strsplit( a, '[^a-zA-Z.]+'))
b <- b[b!="R" & b!="."]
message(paste(b, collapse=" "), "\n")
update.packages(oldPkgs=c(b, "statnet"), ask=F, ...)
# Next, the packages in the Suggests line of statnet/DESCRIPTION:
message("Checking for newer versions of these suggested packages:")
a <- packageDescription("statnet", fields="Suggests")
if (!is.na(a)) {
b <- unlist( strsplit( a, '[^a-zA-Z.]+'))
b <- b[b!="."]
message(paste(b, collapse=" "), "\n")
update.packages(oldPkgs=b, ask="graphics", ...)
# cat("Type Y if you want each of the following suggested",
# "packages to be updated:\n")
# for (s in b) {
# cat(s)
# ans <- scan(what=character(), n=1, quiet=TRUE)
# if (length(ans)>0 && (ans=='Y' || ans=='y')) {
# update.packages(oldPkgs=s, ..., )
# }
# }
}
invisible(NULL)
}