7

尝试在 RStudio 中加载包“TSA”时出现此错误:

Loading required package: leaps
Loading required package: locfit
locfit 1.5-9.1   2013-03-22
Loading required package: mgcv
Loading required package: nlme
Error : .onAttach failed in attachNamespace() for 'mgcv', details:
  call: formatDL(nm, txt, indent = max(nchar(nm, "w")) + 3)
  error: incorrect values of 'indent' and 'width'
Error: package ‘mgcv’ could not be loaded

我尝试重新安装 mgcv 和 TSA,但没有帮助。但是,当我从 R 命令行加载 TSA 时,它可以正常工作。

我该如何解决这个问题?

R 版本 3.0.2 (2013-09-25)

RStudio 0.97.551,64 位。

更新

我在 RStudio 的 32 位安装中测试了这个问题,它完美无缺。我不确定这里的真正罪魁祸首是什么。

4

3 回答 3

20

在 RStudio 中,只需调整右侧的大小以增加窗口的宽度。现在再试library(mgcv)一次,它的工作原理!

于 2014-11-23T08:04:16.717 回答
1

对于在 Windows 7 下遇到类似问题的任何人的参考,我在forecast包中遇到了同样的问题 - 有一天,它无法在 RStudio 中加载(在 R 中工作正常)。必须完全卸载 R 和 RStudio,确保在它再次工作之前删除并重新安装C:\Program Files\RC:\Users\[username]\AppData\Local\RStudio-Desktop如果我只是删除了 RStudio 的东西并试图保留 R 文件,那将无法正常工作。

于 2014-10-27T16:39:05.213 回答
0

终于让它工作了。

我不得不通过删除 rstudiosudo apt-get --purge remove rstudio并删除~/.config/RStudio. 奇怪的是,这并没有删除所有内容,因为当我重新安装 RStudio 时,一些打开的文档仍然存在。然而,它成功了。

> library(TSA)
Loading required package: leaps
Loading required package: locfit
locfit 1.5-9.1   2013-03-22
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.7-26. For overview type 'help("mgcv-package")'.
Loading required package: tseries

    ‘tseries’ version: 0.10-32

    ‘tseries’ is a package for time series analysis and
    computational finance.

    See ‘library(help="tseries")’ for details.


Attaching package: ‘TSA’

The following objects are masked from ‘package:stats’:

    acf, arima

The following object is masked from ‘package:utils’:

    tar

更新

不幸的是,每次我重新启动 RStudio 时,都会遇到与以前相同的错误。所以这只是一个临时解决方案。建议?

更新 2

最终,这个问题似乎得到了解决。我删除~/.rstudio-desktop/monitored/user-settings/并立即解决了问题,无需重新安装 RStudio。

于 2013-09-30T17:35:32.033 回答