安装flextable库时出现错误

3

在安装 flextable 库时,我在 R Studio 中遇到了以下错误。

ERROR: configuration failed for package ‘systemfonts’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/3.2/systemfonts’
Warning in install.packages :
  installation of package ‘systemfonts’ had non-zero exit status
ERROR: dependency ‘systemfonts’ is not available for package ‘gdtools’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/3.2/gdtools’
Warning in install.packages :
  installation of package ‘gdtools’ had non-zero exit status
ERROR: dependency ‘gdtools’ is not available for package ‘flextable’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/3.2/flextable’
Warning in install.packages :
  installation of package ‘flextable’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpN2KD39/downloaded_packages’
2个回答

1

@Sophia Wilson,你的R版本非常旧,只有3.2。在按照以下方式安装新软件包之前,你应该升级你的R版本。如果你的组织不允许你升级R版本,你应该考虑尽可能多地学习使用基础R或使用像Jupyter Notebook这样的IDE/环境。

# Install pacakges if they are not already installed: necessary_packages => character vector
necessary_packages <- c("flextable")

# Create a vector containing the names of any packages needing installation:
# new_pacakges => character vector
new_packages <- necessary_packages[!(necessary_packages %in%
                                       installed.packages()[, "Package"])]

# If the vector has more than 0 values, install the new pacakges
# (and their) associated dependencies: varied => stdout
if(length(new_packages) > 0){install.packages(new_packages, dependencies = TRUE)}

# Initialise the packages in the session: bool => stdout
lapply(necessary_packages, require, character.only = TRUE)

0

尝试安装错误消息明确指出的依赖项:

install.packages("systemfonts")
install.packages("gdtools")
install.packages("flextable")

1
我已经尝试过这个,但出现了错误 `Warning in install.packages : installation of package ‘systemfonts’ had non-zero exit statusThe downloaded source packages are in ‘/tmp/RtmpE9BewA/downloaded_packages’`。 - Sophia Wilson

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接