[Rd] Duplicate Packages in Imports & Suggests
Kurt Hornik
Kurt@Horn|k @end|ng |rom wu@@c@@t
Mon Jun 29 11:08:01 CEST 2026
>>>>> Colin Gillespie writes:
> Hi,
> I've noticed that a few packages duplicate their Imports/Suggest.
> For example, https://cran.r-project.org/web/packages/landpred/index.html
> lists quantreg twice. It's also a problem for
> "landpred","LLMing", "MDgof", "NBDCtools", "PDXpower", "RHclust",
> "toscca", "wrappedtools"
> as well.
> Suggests has the same problem:
> "echarts4r" ,"fgdiR", "httkexamples", "toro", "treestats"
> E.g. https://cran.r-project.org/web/packages/echarts4r/index.html has
> data.tree listed twice
Colin,
Indeed, running something like
a <- available.packages()
a <- a[startsWith(a[, "Repository"], getOption("repos")["CRAN"]), ]
y <- data.frame(Package = a[, "Package"])
fields <- c("Imports", "Depends", "LinkingTo", "Suggests")
for(f in fields)
y[[f]] <- lapply(a[, f], tools:::.extract_dependency_package_names)
z1 <- lapply(fields,
function(f) {
d <- y[[f]]
i <- which(vapply(d, anyDuplicated, 0) > 0)
x <- lapply(d[i], function(e) sort(e[duplicated(e)]))
names(x) <- y$Package[i]
x
})
names(z1) <- fields
z3 <- data.frame(package = unlist(lapply(z1, names), use.names = FALSE),
field = rep.int(names(z1), lengths(z1)))
currently finds
R> z3
package field
1 crane Imports
2 FinanceGraphs Imports
3 landpred Imports
4 LLMing Imports
5 MatrixModels Imports
6 MDgof Imports
7 NBDCtools Imports
8 PDXpower Imports
9 RHclust Imports
10 toscca Imports
11 wrappedtools Imports
12 bmgarch LinkingTo
13 ctsem LinkingTo
14 echarts4r Suggests
15 fgdiR Suggests
16 httkexamples Suggests
17 toro Suggests
18 treestats Suggests
Now actually using the dependencies goes via
tools:::.split_dependencies() which runs unique() after splitting,
reducing the above via
z3 <- Map(function(p, f) {
d <- tools:::.split_dependencies(a[p, f])
d <- split(d, names(d))
d[lengths(d) > 1]
},
z3$package, z3$field)
to
R> names(Filter(length, z3))
[1] "crane" "FinanceGraphs" "MatrixModels"
The last is from having
Imports: stats, methods, Matrix (>= 1.6-0), Matrix(< 1.8-0)
which shows that having duplicated package names is actually ok. The
other two are from having
scales, scales (>= 1.3.0)
utils (>= 4.0.0), utils (>= 4.5.0)
in Imports: likely unintended but harmless afaict.
> Related (but a CRAN question): Could the imports/Suggests be listed
> alphabetically on CRAN pages?
I'll take a look ...
Vest
-k
> Colin
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list