1

我在 R 中有这个脚本:

from rpy import * 
r.library("robustbase") 
adjboxStats(c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, a = -4, b = 3, do.conf = TRUE, do.out = TRUE)

它给了我这个输出:

$stats
[1]    203.900   1834.375  11232.100 133262.800 232223.300

$n
[1] 7

$conf
[1] -67254.84  89719.04

$fence
[1]   -6963.467 5097118.725

$out
[1] 3445532344

相同的脚本,但混合了 R 和 python :

#!/usr/bin/python
from rpy import * 
r.library("robustbase") 

r("adjboxStats")(r.c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, a = -4, b = 3, do_conf = True, do_out = True)

给我这个输出,它缺少栅栏属性(异常值)。

{'out': [-344553234.30000001, 3445532344.3000002], 'stats': [203.90000000000001, 219.05000000000001, 7333.3250000000007, 133262.79999999999, 232223.29999999999], 'conf': [-66986.823877395305, 81653.473877395299], 'n': 8}

当我尝试像这样添加栅栏属性时:

print r("adjboxStats")(r.c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, a = -4, b = 3, do_conf = True, do_out = True, do_fence = True)

我收到此错误消息:

rpy.RPy_RException: Error in function (x, coef = 1.5, a = -4, b = 3, do.conf = TRUE, do.out = TRUE)  :
  unused argument(s) (do.fence = TRUE)

有人为什么会这样吗?

谢谢!

4

0 回答 0