R/directlabels包即使使用给定的示例代码也会生成错误



我已经从http://directlabels.r-forge.r-project.org/,及其依赖项"quadprog"。该页面中的第一个示例有效:

install.packages("directlabels", repo="http://r-forge.r-project.org")
library(lattice)
library(directlabels)
direct.label(xyplot(jitter(Sepal.Length)~jitter(Petal.Length),iris,groups=Species))

但第二个例子没有:

install.packages("ggplot2")
library(ggplot2)
data(BodyWeight,package="nlme")
p <- qplot(Time,weight,data=BodyWeight,colour=Rat,geom="line",facets=.~Diet)
direct.label(p,"first.qp")
direct.label(p,"last.qp")

我试过在两台电脑上运行它:一台是工作电脑,它被锁定,使用旧版本的R(3.5.1(、RStudio(1.1.463(和过时的软件包存储库,需要手动安装"quadprog";另一台是我的家用电脑,它有最新版本的R和RStudion,能够自动安装quadprog。

在工作中运行direct.label(p,"first.qp")产生Error:xmust be a string or a R connection,并在国内生产Error in parse(text = x) : <text>:1:2: unexpected ';' 1: ~;

如果我只运行direct.label(p)工作和家庭生产Error in switch(geom, density = "top.bumptwice", line = { : EXPR must be a length 1 vector。我自己的一个基本ggplot也出现了这个错误。

有可能让这个包裹发挥作用吗?还是现在它太旧了,维护不善?

rforge版本已弃用(如前所述,2015年停止开发(,不得再使用。

您可以从GitHub:安装directlabels的开发版本

# In order to download and install a package from a GitHub hosted repository, install the 'devtools' library (if not available):
if(!require(devtools)) install.packages("devtools")
# Next, install your package using the install_github("username/repo") command:
devtools::install_github("tdhock/directlabels")

或者直接从CRAN镜像中获取它——这是您根据上面的评论(即install.packages("directlabels")(冒险进入的解决方案,如";在不指定存储库的情况下安装";默认为repos的CRAN链接。

我想你的安装方法来源于http://directlabels.r-forge.r-project.org/,上一次更新确实是在几年前。有关软件包和/或文档需求的未来参考,请参阅https://tdhock.github.io/directlabels/现在取而代之。(GitHub回购中的网站链接最近也更新了(

最新更新