【问题标题】:How to make sure RStudio to incorporate changes made in .bashrc如何确保 RStudio 合并在 .bashrc 中所做的更改
【发布时间】:2021-01-26 09:41:48
【问题描述】:

目前在我的 RStudio 中,我运行此代码时出现此错误:

> library(gtools)
> nrow(combinations(n=448,r=2,v=1:448,repeats.allowed=F))
Error: C stack usage  7971524 is too close to the limit

我所做的,是我添加了这一行

ulimit -s 16384

在我的 bashrc 中。

如果我在终端中使用 R 控制台执行上面的 R 代码,则它运行正常。 但是当我运行它 RStudio 控制台时它仍然会出错。

我该如何解决这个问题?

【问题讨论】:

  • 你试过system("ulimit -s 16384")吗?
  • 我试过了。它没有效果。仍然给出错误。

标签: r linux rstudio


【解决方案1】:

ulimit -s 16384 添加到.bashrc 只会影响从bash shell 执行的命令。就像从终端执行 R console 一样(同样的方式,您可以从 bash 执行 RStudio,它会起作用)。

ulimit -s 16384 应用于整个登录会话:

  • 将更改添加到/etc/security/limits.conf 文件。
*            soft    stack           16384                                   
*            hard    stack           16384
  • 注销/登录以申请。
  • 像往常一样运行RStudio 并检查。

【讨论】:

  • @scamander,然后出于调试目的在R 代码中尝试打印ulimit 堆栈值。如果值为16384,则问题与当前堆栈值无关。由于ulimit 是内置的bash,您可以(尝试)使用命令/bin/bash -i -c 'ulimit -a'R 代码执行它。
猜你喜欢
  • 2012-01-09
  • 1970-01-01
  • 2021-03-14
  • 2018-10-10
  • 2014-08-05
  • 1970-01-01
  • 2011-09-29
  • 1970-01-01
  • 2017-05-30
相关资源
最近更新 更多