2

我正在使用该expss软件包为调查数据生成横幅表,但我不断收到一个在 Google 上没有出现的错误:Error in data.table(cell_var, col_var, row_var) : object '.R.listCopiesNamed' not found.

我在下面创建了一个可重现的示例。我不清楚这是来自expss或来自的错误data.table,还是来自两者的组合。无论如何,有一种方法可以覆盖对 的需要'.R.listCopiesNamed',或者其他解决错误的方法?

我在这种环境中工作:
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

~ ~ ~ ~ ~ ~ _

编辑添加 traceback() 和 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
4

1 回答 1

3

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

于 2018-06-28T16:54:49.250 回答