来自Shinyapps.io服务器上data.table的错误,但不是本地错误

时间:2018-11-07 15:26:52

标签: r shiny data.table shinyapps expss

我正在开发我的第一个闪亮的应用程序-它在本地运行良好,但是当我发布到Shinyapps.io时会产生错误:Error in data.table: object '.R.listCopiesNamed' not found

I have encountered this error locally before, but the issue was resolved when I updated my packages.由于该错误很容易在本地解决,并且由于该错误似乎取决于该应用程序所使用的软件包的版本,因此我怀疑本地环境中存在某些闪亮的应用程序。 io不在服务器上重新创建-但是我不知道如何跟踪未重新创建的内容以便将其添加到我的代码中。

我尝试过的事情(都会产生相同的错误):

任何人都可以了解一些本地发生的事情,这些事情没有在Shinyapps.io服务器上复制吗?谢谢!

可复制的示例:

library(shiny)
library(data.table)
library(expss)
library(DT)
library(lubridate)
library(tidyverse)

# define UI for application
ui <- fixedPage(
# sidebar with dropdown menus for selecting year, month, and question
fixedRow(
    column(4,
           # dropdown menu for year
           selectInput(inputId = "myYear",
                       label = "Year",
                       choices = c("2018"), # update this list once per year
                       selected = "2018"),  # change this to current year
           # dropdown menu for month
           selectInput(inputId = "myMonth",
                       label = "Month",
                       choices = c(# "January" = 01, 
                           # "February" = 02, 
                           # "March" = 03, 
                           # "April" = 04, 
                           # "May" = 05,
                           # "June" = 06, 
                           # "July" = 07, 
                           # "August" = 08, 
                           "September" = "09", 
                           "October" = "10" #, 
                           # "November" = "11", 
                           # "December" = "12"
                       )),
           # dropdown menu for question
           selectInput(inputId = "myQuestion",
                       label = "Question",
                       choices = c("Q2_awareness", "Q3_association"))),

    # show a data table
    column(8, dataTableOutput("myBrandTable"))
)
)



# ------------------------------------------------------------------------ #
##### LOAD THE DATA FRAMES TO WORK WITH #####
# ------------------------------------------------------------------------ #

# create data
set.seed(123)
myBrandData <- data.frame(
brand = sample(c("Brand A", "Brand B", "Brand C", "Brand D", "Brand E", "Brand F", "Brand G"),
               100, replace = TRUE),
report_date = sample(c("Benchmark", "September 2018", "October 2018"),
                     100, replace = TRUE),
Q2_awareness = sample(c(0, 1), 100, replace = TRUE),
Q3_awareness = sample(c(0, 1), 100, replace = TRUE)
)

# relevel some factors so they show up in the desired order
myBrandData <- myBrandData %>%
mutate(report_date = fct_relevel(report_date,
                                 "Benchmark",
                                 "September 2018",
                                 "October 2018")) %>%
mutate_at(vars(starts_with("Q")), funs(as.numeric(.)))

# ------------------------------------------------------------------------ #
###### HELPER FUNCTIONS #####
# ------------------------------------------------------------------------ #

# a function from Gregory Demin for calculating stats on dichotomous multiple response variables
tab_stat_dich = function(data, total_label = NULL, total_statistic = "u_cases",
                     label = NULL){

if (missing(total_label) && !is.null(data[["total_label"]])) {
    total_label = data[["total_label"]]
}
if(is.null(total_label)){
    total_label = "#Total"
}

# calculate means
res = eval.parent(
    substitute(
        tab_stat_mean_sd_n(data,
                           weighted_valid_n = "w_cases" %in% total_statistic,
                           labels = c("|", "@@@@@", total_label),
                           label = label)
    )
)
curr_tab = res[["result"]][[length(res[["result"]])]]
# drop standard deviation
curr_tab = curr_tab[c(TRUE, FALSE, TRUE), ]

# convert means to percent
curr_tab[c(TRUE, FALSE), -1] = curr_tab[c(TRUE, FALSE), -1] * 100
## clear row labels
curr_tab[[1]] = gsub("^(.+?)\\|(.+)$", "\\2", curr_tab[[1]], perl = TRUE )

res[["result"]][[length(res[["result"]])]] = curr_tab
res
}


# define server logic required to create the line graph & data table
server <- function(input, output) {
# ------------------------------------------------------------------------ #
##### MODIFY THE DATA FRAMES THAT GO INTO THE OUTPUTS ####
# ------------------------------------------------------------------------ #

myBrandTableData <- reactive({
    myBrandData %>%
        mutate(brand = fct_relevel(brand,
                                   "Brand A",
                                   "Brand B",
                                   "Brand C", 
                                   "Brand D", 
                                   "Brand E", 
                                   "Brand F", 
                                   "Brand G")) %>%
        select(report_date, Brand = brand, Variable = input$myQuestion)
})

# ------------------------------------------------------------------------ #
##### BUILD THE OUTPUTS #####
# ------------------------------------------------------------------------ #

# build the data table for brand comparisons
output$myBrandTable <- renderDataTable({
    # some note about the table
    as.datatable_widget(
        myBrandTableData() %>%
                tab_cells(Variable) %>%
                tab_cols(Brand) %>%
                tab_total_label("# Responses") %>%
                tab_stat_dich() %>%
                tab_last_sig_cpct() %>%
                tab_pivot()
    )
})
}

# Run the application 
shinyApp(ui = ui, server = server)

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] bindrcpp_0.2.2    forcats_0.3.0     stringr_1.3.1     dplyr_0.7.7       purrr_0.2.5       readr_1.1.1      
 [7] tidyr_0.8.2       tibble_1.4.2      ggplot2_3.1.0     tidyverse_1.2.1   lubridate_1.7.4   DT_0.5           
[13] expss_0.8.7       data.table_1.11.8 shiny_1.2.0      

loaded via a namespace (and not attached):
[1] Rcpp_0.12.19       lattice_0.20-35    assertthat_0.2.0   digest_0.6.18      mime_0.6          
 [6] R6_2.3.0           cellranger_1.1.0   plyr_1.8.4         backports_1.1.2    httr_1.3.1        
[11] pillar_1.3.0       rlang_0.3.0.1      lazyeval_0.2.1     readxl_1.1.0       rstudioapi_0.8    
[16] checkmate_1.8.5    labeling_0.3       foreign_0.8-71     htmlwidgets_1.3    RCurl_1.95-4.11   
[21] munsell_0.5.0      broom_0.5.0        compiler_3.4.4     httpuv_1.4.5       modelr_0.1.2      
[26] pkgconfig_2.0.2    htmltools_0.3.6    tidyselect_0.2.5   htmlTable_1.12     matrixStats_0.54.0
[31] crayon_1.3.4       withr_2.1.2        later_0.7.5        bitops_1.0-6       grid_3.4.4        
[36] nlme_3.1-131.1     jsonlite_1.5       xtable_1.8-3       gtable_0.2.0       magrittr_1.5      
[41] scales_1.0.0       cli_1.0.1          stringi_1.2.4      promises_1.0.1     xml2_1.2.0        
[46] tools_3.4.4        RJSONIO_1.3-0      glue_1.3.0         hms_0.4.2          crosstalk_1.0.0   
[51] rsconnect_0.8.8    yaml_2.2.0         colorspace_1.3-2   rvest_0.3.2        knitr_1.20        
[56] bindr_0.1.1        haven_1.1.2       

日志文件中的行:

2018-11-07T15:12:29.128343+00:00 shinyapps[556963]: ✖ lubridate::intersect()   masks base::intersect()
2018-11-07T15:12:29.128348+00:00 shinyapps[556963]: ✖ dplyr::na_if()           masks expss::na_if()
2018-11-07T15:12:29.128349+00:00 shinyapps[556963]: ✖ tidyr::nest()            masks expss::nest()
2018-11-07T15:12:29.128349+00:00 shinyapps[556963]: ✖ lubridate::quarter()     masks data.table::quarter()
2018-11-07T15:12:29.128350+00:00 shinyapps[556963]: ✖ dplyr::recode()          masks expss::recode()
2018-11-07T15:12:29.128345+00:00 shinyapps[556963]: ✖ dplyr::lst()             masks tibble::lst(), expss::lst()
2018-11-07T15:12:29.128350+00:00 shinyapps[556963]: ✖ stringr::regex()         masks expss::regex()
2018-11-07T15:12:29.128346+00:00 shinyapps[556963]: ✖ lubridate::mday()        masks data.table::mday()
2018-11-07T15:12:29.128351+00:00 shinyapps[556963]: ✖ lubridate::second()      masks data.table::second()
2018-11-07T15:12:29.128346+00:00 shinyapps[556963]: ✖ lubridate::minute()      masks data.table::minute()
2018-11-07T15:12:29.128351+00:00 shinyapps[556963]: ✖ lubridate::setdiff()     masks base::setdiff()
2018-11-07T15:12:29.128347+00:00 shinyapps[556963]: ✖ purrr::modify()          masks expss::modify()
2018-11-07T15:12:29.128352+00:00 shinyapps[556963]: ✖ purrr::transpose()       masks expss::transpose(), data.table::transpose()
2018-11-07T15:12:29.128347+00:00 shinyapps[556963]: ✖ purrr::modify_if()       masks expss::modify_if()
2018-11-07T15:12:29.128352+00:00 shinyapps[556963]: ✖ lubridate::union()       masks base::union()
2018-11-07T15:12:29.128347+00:00 shinyapps[556963]: ✖ lubridate::month()       masks data.table::month()
2018-11-07T15:12:29.128353+00:00 shinyapps[556963]: ✖ dplyr::vars()            masks ggplot2::vars(), expss::vars()
2018-11-07T15:12:29.128353+00:00 shinyapps[556963]: ✖ lubridate::wday()        masks data.table::wday()
2018-11-07T15:12:29.128353+00:00 shinyapps[556963]: ✖ lubridate::week()        masks data.table::week()
2018-11-07T15:12:29.128354+00:00 shinyapps[556963]: ✖ lubridate::yday()        masks data.table::yday()
2018-11-07T15:12:29.128354+00:00 shinyapps[556963]: ✖ lubridate::year()        masks data.table::year()
2018-11-07T15:12:29.329815+00:00 shinyapps[556963]: 
2018-11-07T15:12:29.329817+00:00 shinyapps[556963]: Listening on http://127.0.0.1:42714
2018-11-07T15:12:39.608656+00:00 shinyapps[556963]: Warning: Error in data.table: object '.R.listCopiesNamed' not found
2018-11-07T15:12:39.615998+00:00 shinyapps[556963]:   135: data.table
2018-11-07T15:12:39.615999+00:00 shinyapps[556963]:   134: elementary_cro_fun_df
2018-11-07T15:12:39.616000+00:00 shinyapps[556963]:   133: FUN
2018-11-07T15:12:39.616000+00:00 shinyapps[556963]:   132: lapply
2018-11-07T15:12:39.616001+00:00 shinyapps[556963]:   131: FUN
2018-11-07T15:12:39.616001+00:00 shinyapps[556963]:   130: lapply
2018-11-07T15:12:39.616002+00:00 shinyapps[556963]:   129: cro_fun
2018-11-07T15:12:39.616002+00:00 shinyapps[556963]:   128: tab_stat_fun_internal
2018-11-07T15:12:39.616003+00:00 shinyapps[556963]:   127: tab_stat_mean_sd_n
2018-11-07T15:12:39.616004+00:00 shinyapps[556963]:   121: freduce
2018-11-07T15:12:39.616003+00:00 shinyapps[556963]:   122: function_list[[i]]
2018-11-07T15:12:39.616004+00:00 shinyapps[556963]:   120: _fseq
2018-11-07T15:12:39.616005+00:00 shinyapps[556963]:   119: eval
2018-11-07T15:12:39.616005+00:00 shinyapps[556963]:   118: eval
2018-11-07T15:12:39.616006+00:00 shinyapps[556963]:   116: %>%
2018-11-07T15:12:39.616007+00:00 shinyapps[556963]:   114: exprFunc [/srv/connect/apps/test/app.R#133]
2018-11-07T15:12:39.616007+00:00 shinyapps[556963]:   113: widgetFunc
2018-11-07T15:12:39.616008+00:00 shinyapps[556963]:   112: func
2018-11-07T15:12:39.616044+00:00 shinyapps[556963]:    99: origRenderFunc
2018-11-07T15:12:39.616045+00:00 shinyapps[556963]:    98: renderFunc
2018-11-07T15:12:39.616046+00:00 shinyapps[556963]:    94: origRenderFunc
2018-11-07T15:12:39.616047+00:00 shinyapps[556963]:    93: output$myBrandTable
2018-11-07T15:12:39.616084+00:00 shinyapps[556963]:    12: fn
2018-11-07T15:12:39.616085+00:00 shinyapps[556963]:     6: eval
2018-11-07T15:12:39.616083+00:00 shinyapps[556963]:    13: runApp
2018-11-07T15:12:39.616085+00:00 shinyapps[556963]:     5: eval
2018-11-07T15:12:39.616084+00:00 shinyapps[556963]:     7: connect$retry

1 个答案:

答案 0 :(得分:1)

解决方案:更新R&RStudio软件。