小编bog*_*cis的帖子

使用多个LHS拟合线性模型

我是R的新手,我想用一个*apply函数改进下面的脚本(我已经读过apply,但我无法使用它).我想lm在多个独立变量(数据框中的列)上使用函数.我用了

for (i in (1:3) {
  assign(paste0('lm.',names(data[i])), lm(formula=formula(i),data=data))
  } 
Run Code Online (Sandbox Code Playgroud)

Formula(i) 被定义为

formula=function(x)
{
  as.formula ( paste(names(data[x]),'~', paste0(names(data[-1:-3]), collapse = '+')), env=parent.frame() )
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

regression r linear-regression lm mlm

5
推荐指数
1
解决办法
1727
查看次数

安装包“Rmpfr”的退出状态为非零

请帮我在 R 中安装 Rmpfr 包。结果是:安装包 'Rmpfr' 的退出状态非零,我无法安装它。

R控制台的代码发布如下:

* installing *source* package ‘Rmpfr’ ...
** package ‘Rmpfr’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes …
Run Code Online (Sandbox Code Playgroud)

installation r package

3
推荐指数
1
解决办法
4268
查看次数

标签 统计

r ×2

installation ×1

linear-regression ×1

lm ×1

mlm ×1

package ×1

regression ×1