Ответ 1
Взято из reverse_dependencies_with_maintainers
, которое было доступно в какой-то момент на сайте R developerWorks (теперь я его не вижу):
description <- sprintf("%s/web/packages/packages.rds",
getOption("repos")["CRAN"])
con <- if(substring(description, 1L, 7L) == "file://") {
file(description, "rb")
} else {
url(description, "rb")
}
db <- as.data.frame(readRDS(gzcon(con)),stringsAsFactors=FALSE)
close(con)
rownames(db) <- NULL
head(db$Author)
head(db$"[email protected]")
Где [email protected]
существует, он может обрабатываться в чем-то лучше, используя dget()
getAuthor <- function(x){
if(is.na(x)) return(NA)
a <- textConnection(x)
on.exit(close(a))
dget(a)
}
authors <- lapply(db$"[email protected]", getAuthor)
head(authors)
[[1]]
[1] NA
[[2]]
[1] "Gaurav Sood <[email protected]> [aut, cre]"
[[3]]
[1] "Csillery Katalin <[email protected]> [aut]"
[2] "Lemaire Louisiane [aut]"
[3] "Francois Olivier [aut]"
[4] "Blum Michael <[email protected]> [aut, cre]"
[[4]]
[1] NA
[[5]]
[1] "Csillery Katalin <[email protected]> [aut]"
[2] "Lemaire Louisiane [aut]"
[3] "Francois Olivier [aut]"
[4] "Blum Michael <[email protected]> [aut, cre]"
[[6]]
[1] NA