expss和data.table播放不佳 [英] `expss` and `data.table` not playing well together

查看:98
本文介绍了expss和data.table播放不佳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用expss包来生成用于调查数据的标题表,但是我不断收到一个错误,该错误在Google上很少出现:Error in data.table(cell_var, col_var, row_var) : object '.R.listCopiesNamed' not found.

I am working with the expss package to produce banner tables for survey data, but I keep getting an error that doesn't come up a lot on Google: Error in data.table(cell_var, col_var, row_var) : object '.R.listCopiesNamed' not found.

我在下面创建了一个可复制的示例.我不清楚这是expss还是data.table或两者的结合导致的错误.无论如何,有没有一种方法可以替代对'.R.listCopiesNamed'的需求,或者通过其他方法来解决该错误?

I've created a reproducible example below. It's unclear to me if it's an error from expss or from data.table, or from the combination of the two. In any case there a way to override the need for '.R.listCopiesNamed', or some other way to resolve the error?

我正在此环境中工作:
R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin15.6.0 (64-bit)

I'm working in this environment:
R version 3.4.4 (2018-03-15) -- "Someone to Lean On" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin15.6.0 (64-bit)

可复制的示例:

# load packages
library(expss)
library(tidyverse)

# generate some data
set.seed(369)
age <- base::sample(c("18-24", "25-24", "35-44", "45-54", "55-64", "65+"), 
                    100, replace = TRUE)
sex <- base::sample(c("Male", "Female"), 
                    100, replace = TRUE)
likelihood <- base::sample(c("Much more likely", "Somewhat more likely", 
                             "Equally likely", "Somewhat less likely", 
                             "Much less likely"), 100, replace = TRUE)
importance <- base::sample(c("Extremely important", "Somewhat important", 
                             "Neutral", "Somewhat unimportant", 
                             "Extremely unimportant"), 100, replace = TRUE)
relevance <- base::sample(c("Extremely relevant", "Somewhat relevant", 
                            "Neutral", "Somewhat irrelevant", 
                            "Extremely irrelevant"), 100, replace = TRUE)
data <- data.frame(age, sex, likelihood, importance, relevance)

# make a simple banner table with significance testing
myTable <- data %>%
    tab_cells(likelihood, importance, relevance) %>%
    tab_cols(total(), age, sex) %>%
    tab_stat_cpct() %>%
    tab_last_sig_cpct() %>%
    tab_pivot()

这时,我得到了错误:
Error in data.table(cell_var, col_var, row_var) : object '.R.listCopiesNamed' not found

At this point, I get the error:
Error in data.table(cell_var, col_var, row_var) : object '.R.listCopiesNamed' not found

编辑后添加traceback()和sessionInfo():

Edited to add traceback() and sessionInfo():

> traceback()
19: data.table(cell_var, col_var, row_var)
18: make_datatable_for_cro(cell_var = cell_var, col_var = col_var, 
        row_var = row_var, weight = weight, subgroup = subgroup)
17: elementary_cro(cell_var = each_cell_var, col_var = each_col_var, 
        row_var = each_row_var, weight = weight, subgroup = subgroup, 
        total_label = total_label, total_statistic = total_statistic, 
        total_row_position = total_row_position, stat_type = stat_type)
16: FUN(X[[i]], ...)
15: lapply(col_vars, function(each_col_var) {
        elementary_cro(cell_var = each_cell_var, col_var = each_col_var, 
            row_var = each_row_var, weight = weight, subgroup = subgroup, 
            total_label = total_label, total_statistic = total_statistic, 
            total_row_position = total_row_position, stat_type = stat_type)
    })
14: FUN(X[[i]], ...)
13: lapply(cell_vars, function(each_cell_var) {
        all_col_vars = lapply(col_vars, function(each_col_var) {
            elementary_cro(cell_var = each_cell_var, col_var = each_col_var, 
                row_var = each_row_var, weight = weight, subgroup = subgroup, 
                total_label = total_label, total_statistic = total_statistic, 
                total_row_position = total_row_position, stat_type = stat_type)
        })
        Reduce(merge, all_col_vars)
    })
12: FUN(X[[i]], ...)
11: lapply(row_vars, function(each_row_var) {
        res = lapply(cell_vars, function(each_cell_var) {
            all_col_vars = lapply(col_vars, function(each_col_var) {
                elementary_cro(cell_var = each_cell_var, col_var = each_col_var, 
                    row_var = each_row_var, weight = weight, subgroup = subgroup, 
                    total_label = total_label, total_statistic = total_statistic, 
                    total_row_position = total_row_position, stat_type = stat_type)
            })
            Reduce(merge, all_col_vars)
        })
        res = do.call(add_rows, res)
    })
10: multi_cro(cell_vars = cell_vars, col_vars = col_vars, row_vars = row_vars, 
        weight = weight, subgroup = subgroup, total_label = total_label, 
        total_statistic = total_statistic, total_row_position = total_row_position, 
        stat_type = "cpct")
9: cro_cpct(cell_vars = get_cells(data), col_vars = data[[COL_VAR]], 
       row_vars = data[[ROW_VAR]], weight = data[[WEIGHT]], subgroup = 
data[[SUBGROUP]], 
       total_label = total_label, total_statistic = total_statistic, 
       total_row_position = total_row_position)
8: tab_stat_cpct(.)
7: function_list[[i]](value)
6: freduce(value, `_function_list`)
5: `_fseq`(`_lhs`)
4: eval(quote(`_fseq`(`_lhs`)), env, env)
3: eval(quote(`_fseq`(`_lhs`)), env, env)
2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
1: data %>% tab_cells(likelihood, importance, relevance) %>% tab_cols(total(), 
       age, sex) %>% tab_stat_cpct() %>% tab_last_sig_cpct() %>% 
       tab_pivot()


> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib

LAPACK: 
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] expss_0.8.6

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17       matrixStats_0.53.1 digest_0.6.15      backports_1.1.2   
 [5] magrittr_1.5       stringi_1.1.6      data.table_1.11.4  rstudioapi_0.7    
 [9] checkmate_1.8.5    tools_3.4.4        stringr_1.3.0      foreign_0.8-69    
[13] htmlwidgets_1.2    yaml_2.1.17        compiler_3.4.4     htmltools_0.3.6   
[17] knitr_1.20         htmlTable_1.11.2

推荐答案

解决方案:更新expss包.感谢@MichaelChirico的建议!

The solution: Update the expss package. Thanks to @MichaelChirico for the suggestion!

这篇关于expss和data.table播放不佳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆