Security issues with CRAN packages

[ Edit: June 2013 ] A paper has appeared on ArXiv describing this issue in greater detail, and suggesting some solutions: http://arxiv.org/abs/1303.4808. It will appear in the Journal of Statistical Software later in 2013. I have a cronjob on my Ubuntu servers that downloads and installs every source package from CRAN. However on the same server I started to notice some irregular activity. I

CRAN软件包的安全问题

[编辑:2013年6月] ArXiv上发表了一篇论文,详细描述了这个问题,并提出了一些解决方案:http://arxiv.org/abs/1303.4808。 它将在2013年晚些时候出现在统计软件杂志上。 我的Ubuntu服务器上有一个cronjob,用于从CRAN下载并安装每个源代码包。 但是在同一台服务器上,我开始注意到一些不规则的活动。 它可能完全不相关,但它让我想到了是否有可能有一些CRAN软件包包含恶意代码。 创建和发布cran包的过程非常简单。 也许

rotating axis labels in R

在R中,如何将(条形)图的y轴标签与X轴平行而不是平行于Y轴? Not sure if this is what you mean, but try setting las=1 . Here's an example: require(grDevices) tN <- table(Ni <- stats::rpois(100, lambda=5)) r <- barplot(tN, col=rainbow(20), las=1) That represents the style of axis labels. (0=parallel, 1=all horizontal, 2=all perpendicular to axis, 3=all vertical) Use par(las=1) .

在R中旋转轴标签

在R中,如何将(条形)图的y轴标签与X轴平行而不是平行于Y轴? 不确定这是不是你的意思,但尝试设置las=1 。 这是一个例子: require(grDevices) tN <- table(Ni <- stats::rpois(100, lambda=5)) r <- barplot(tN, col=rainbow(20), las=1) 这代表了轴标签的风格。 (0 =平行,1 =全部水平,2 =全部垂直于轴,3 =全部垂直) 使用par(las=1) 。 请参阅?par : las numeric in {0,1,2,3}; the style of axis lab

Force install.packages()

Is it possible to install a package in R forcefully ? > install.packages("gsubfn") Installing package(s) into ‘/home/sebastian/R/x86_64-unknown-linux-gnu-library/2.14’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘gsubfn’ is not availab

强制install.packages()

是否有可能强制在R中安装软件包? > install.packages("gsubfn") Installing package(s) into ‘/home/sebastian/R/x86_64-unknown-linux-gnu-library/2.14’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘gsubfn’ is not available (for R version 2.14

Change default arguments of an R function at runtime

Is it possible to change the default values of formal parameters in an R function at runtime? Let's assume, we have the function f <- function(x=1) { ... } can I somehow change the default value of x from 1 to, say, 2? Thanks in advance, Sven 是的,默认包允许你这样做。 一种替代(在不同的SO后示出)是使用formals的功能,例如: formals(f) <- 2

在运行时更改R函数的默认参数

运行时是否可以更改R函数中形式参数的默认值? 我们假设,我们有这个功能 f <- function(x=1) { ... } 我可以以某种方式将x的默认值从1更改为2,比如说2? 提前致谢, 斯文 是的,默认包允许你这样做。 一种替代(在不同的SO后示出)是使用formals的功能,例如: formals(f) <- 2

How can I prevent R from loading a package?

I am using the multicore package in R for parallelizing my code. However, if the tcltk package is loaded, forking processes with the multicore package will cause R to hang indefinitely. So I want to prevent tcltk from ever loading. I want an immediate error if any package tries to load it as a dependency. Is this possible? Alternatively, can I unload a package after it has been loaded? If

我如何防止R加载一个包?

我使用R中的多核包来并行化我的代码。 但是,如果加载了tcltk程序包,则使用多核程序包进行分叉处理将导致R无限期地挂起。 所以我想阻止tcltk加载。 如果任何包试图加载它作为一个依赖项,我想立即发生错误。 这可能吗? 或者,我可以在加载后卸载软件包吗? 如果在连接后立即拆下包装是一个很好的解决方案,那么请尝试如下所示: setHook(hookName = packageEvent("tcltk", "attach"), value = function(...)

Less or equal for floats in R

Assuming I want test if 'a' is less or equal than 'b' when both are floats. I would go with isTRUE(all.equal(a,b)) || a <= b I'm wondering if there's a better way than this. Is there a function like all.equal for less or equal ( / greater than equal ) that allows "near equality"? And what should one do if instead of single numbers one wants to compare tw

在R中花车少或相等

假设我想测试,如果'a'小于或等于'b',当两者都是浮点数时。 我会一起去的 isTRUE(all.equal(a,b)) || a <= b 我想知道是否有比这更好的方法。 是否有像all.equal这样的函数用于少或相等(/大于等于)以允许“接近平等”? 如果不是一个人想要比较两个花车向量,而应该做什么? 更新 :@shadow指向我在R中的数字比较难度 人们当然可以明确地设置容忍度并避免all.equal: tol = 1e-5 # a equals b ab

comprehensible modulo calculation

This question already has an answer here: Why are these numbers not equal? 3 answers This is due to floating point errors, you should look for low absolute differences instead of exact matches. It is not 0.6, but (just an example) 0.6000000003 or 0.5999999997. Try something like: ifelse((abs((d*10) %% 2)<0.000001), d, NA)

可理解的模数计算

这个问题在这里已经有了答案: 为什么这些数字不相等? 3个答案 这是由于浮点错误,你应该寻找低绝对差异而不是精确匹配。 它不是0.6,但(只是一个例子)0.6000000003或0.5999999997。 试试像这样: ifelse((abs((d*10) %% 2)<0.000001), d, NA)

How to calculate confidence for non standard bands?

So I have a dataset : dt<-c(1106,1402, 827, 781,876, 1134,1014, 964, 848, 814, 772, 912, 923, 996, 569, 774, 1389, 900) lets assume a normal curve and running t.test(dt) I get One Sample t-test data: dt t = 19.057, df = 17, p-value = 6.579e-13 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 839.9344 1049.0656 sample estimates: mean of x 944.5 Which is

如何计算非标准频带的置信度?

所以我有一个数据集: dt<-c(1106,1402, 827, 781,876, 1134,1014, 964, 848, 814, 772, 912, 923, 996, 569, 774, 1389, 900)假设一个正态曲线并运行我得到的t.test(dt) 一个样本t检验 数据:dt t = 19.057,df = 17,p值= 6.579e-13备选假设:真实平均值不等于0 95%置信区间:839.9344 1049.0656样本估计值:x平均值944.5 这是95%置信区间的所有标准票价。 但是我想找到的是从850到900这样的特定范围内的信心。因

Calculate Spearman correlation and corrected p

I am calculating spearman correlation between x and y variables (both datasets have some values that are equal), using R. I used: cor.test(x, y, method= "spearman") And I get a warning message: Cannot compute exact p-value with ties My x data it's like: 0.84, 0.84, 0.07, 0.173 My y data it's like: 6, 2, 4, 2 I would like to solve this problem. I read these two questions: Spearman

计算Spearman相关性并更正p

我正在计算x和y变量之间的spearman相关性(两个数据集都有一些相同的值),使用R.我使用: cor.test(x, y, method= "spearman") 我收到一条警告消息: Cannot compute exact p-value with ties 我的x数据就像这样:0.84,0.84,0.07,0.173我的y数据是这样的:6,2,4,2 我想解决这个问题。 我读了这两个问题: 斯皮尔曼相关和关系 Spearman的R领带中的cor.test是否正确? 但我仍然无法解决我的问题。 你可以帮我吗

Monte Carlo simulation in R

I am trying to simulate data (Y) from an AR(1) model with rho=0.7. Then I will use this data to run a regression of Y on an intercept ( by so doing the parameter estimate becomes the mean of Y), then test the null hypothesis of the coefficient being less than or equal to zero ( alternative is greater than 0) using robust standard errors. I want to run a Monte Carlo simulation of this hypothesis

蒙特卡罗模拟在R

我试图用rho = 0.7模拟来自AR(1)模型的数据(Y)。 然后,我将使用这些数据在截距上运行Y的回归(通过这样做参数估计变成Y的均值),然后测试系数的零假设小于或等于零(可选方式大于0 )使用强大的标准错误。 我想运用这个假设的Monte Carlo模拟,使用2000次重复计算不同的滞后值。 目的是为了显示Newey West估计量的滞后变化的有限样本性能。 所以这就是我的开始 A<-array(0, dim=c(2000,1)) for(i in 1:2000){ y_n