简体   繁体   English

R调查问卷中的多核论点

[英]multicore argument in R's survey package

When attempting to use the multicore = TRUE argument in R's survey package, I get the following error: 尝试在R的survey包中使用multicore = TRUE参数时,出现以下错误:

Error in glm.control(multicore = TRUE) :
  unused argument (multicore = TRUE)

Example code for replication: 复制示例代码:

library(tidyverse)
library(survey)

mtcars %<>%
  mutate(weights = 1) %>%
  mutate(id = ceiling(row_number()/2)) %>%
  mutate(strata = ceiling(row_number()/4))

design <- svydesign(id =~ id, weights =~ weights, strata =~ strata,
                data = mtcars)

model <- svyglm(design = design, mpg ~ drat + wt + qsec,
            multicore=TRUE)

mutlicore does appear as a possible argument in the documentation for svyglm . mutlicore确实在svyglm的文档中作为可能的参数出现。 This thread indicates that this argument may not work on Windows, but I'm running this on a Unix system. 该线程表明该参数可能不适用于Windows,但我正在Unix系统上运行它。

I know the multicore package has been deprecated in favor of parallel , and the documentation here suggests that the survey package has been updated to reflect this change (see revision 3.29-5), but I'm not sure if or how that may be involved in this issue. 我知道不赞成使用multicore软件包,而建议使用parallel ,并且这里的文档表明survey软件包已经更新以反映此更改(请参阅修订版3.29-5),但是我不确定是否涉及或如何涉及到该软件包。在这个问题上。

I've also tried installing and loading the obsolete multicore with the following code, but this does fix the issue. 我还尝试使用以下代码安装和加载过时的multicore ,但这确实可以解决问题。

url <- "https://cran.r-project.org/src/contrib/Archive/multicore/multicore_0.2.tar.gz"
pkgFile <- "multicore_0.2.tar.gz"
download.file(url, destfile = pkgFile)
install.packages(pkgs = pkgFile, type="source", repos=NULL)
library(multicore)

multicore =选项仅在复制权重设计和svyby()中实现,因为它们是唯一允许多核支持的粗粒度并行性的分析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM