GithubHelp home page GithubHelp logo

distcomp's People

Contributors

bnaras avatar hrpcisd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

distcomp's Issues

Error checking pVals when running master$run()

I am currently prototyping the linear model, and I wanted to write an example script. I mimicked the script from the Cox model and replaced the appropriate objects with linear model objects. But when I call master$run(), I get the following error:

Error in if (any(pVals != pVals[1])) { : 
  missing value where TRUE/FALSE needed

I tried debugging using the original Cox model code as a guide, but I get the same error running the UIS example. Here is a reprex of the error:

library(distcomp)
#> Loading required package: survival

## First we do the conventional thing.

uis <- readRDS("uis.RDS")
#> Warning in gzfile(file, "rb"): cannot open compressed file 'uis.RDS', probable
#> reason 'No such file or directory'
#> Error in gzfile(file, "rb"): cannot open the connection
coxOrig <- coxph(formula=Surv(time, censor) ~ age + becktota + ndrugfp1 + ndrugfp2 +
                     ivhx3 + race + treat + strata(site), data=uis)
#> Error in terms.formula(formula, specials = ss, data = data): object 'uis' not found
summary(coxOrig)
#> Error in summary(coxOrig): object 'coxOrig' not found

## We define the computation

coxDef <- data.frame(compType = names(availableComputations())[2],
                     formula = "Surv(time, censor) ~ age + becktota + ndrugfp1 + ndrugfp2 + ivhx3 + race + treat",
                     id = "UIS",
                     stringsAsFactors=FALSE)

library(opencpu)
#> Loading config from C:/Users/crame/Documents/R/win-library/3.6/opencpu/config/defaults.conf
#> Loading config from C:\Users\crame\AppData\Local\opencpu\opencpu/user.conf
#> Welcome to OpenCPU!
## We split the data by site
siteData <- with(uis, split(x=uis, f=site))
#> Error in with(uis, split(x = uis, f = site)): object 'uis' not found
nSites <- length(siteData)
#> Error in eval(expr, envir, enclos): object 'siteData' not found
# sites <- lapply(seq.int(nSites),
#                 function(x) list(name = paste0("site", x),
#                                  url = opencpu$url()))
sites <- lapply(seq_along(siteData),
                function(x) list(name = paste0("site", x),
                                 worker = makeWorker(defn = lmDef, data = siteData[[x]])
                ))
#> Error in lapply(seq_along(siteData), function(x) list(name = paste0("site", : object 'siteData' not found

ok <- Map(uploadNewComputation, sites,
          lapply(seq.int(nSites), function(i) coxDef),
          siteData)
#> Error in mapply(FUN = f, ..., SIMPLIFY = FALSE): object 'sites' not found

#stopifnot(all(as.logical(ok)))

master <- makeMaster(coxDef) #CoxMaster$new(defnId = coxDef$id, formula=coxDef$formula)

# for (site in sites) {
#   master$addSite(name = site$name, url = site$url)
# }
for (site in sites) {
  master$addSite(name = site$name, worker = site$worker)
}
#> Error in eval(expr, envir, enclos): object 'sites' not found

result <- master$run()
#> Error in master$run(): 'list' object cannot be coerced to type 'double'

master$summary()
#> Warning in master$summary(): Calculating...
#> Error in run(): could not find function "run"

print(master$summary(), digits=5)
#> Warning in master$summary(): Calculating...
#> Error in run(): could not find function "run"

sessionInfo()
#> R version 3.6.2 (2019-12-12)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 18362)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.1252 
#> [2] LC_CTYPE=English_United States.1252   
#> [3] LC_MONETARY=English_United States.1252
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] opencpu_2.1.5  distcomp_1.2   survival_3.1-8
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.3       compiler_3.6.2   pillar_1.4.2     later_1.0.0     
#>  [5] highr_0.8        tools_3.6.2      digest_0.6.23    jsonlite_1.6    
#>  [9] evaluate_0.14    tibble_2.1.3     lattice_0.20-38  pkgconfig_2.0.3 
#> [13] rlang_0.4.2      Matrix_1.2-18    shiny_1.4.0      parallel_3.6.2  
#> [17] yaml_2.2.0       xfun_0.12        fastmap_1.0.1    stringr_1.4.0   
#> [21] dplyr_0.8.3      httr_1.4.1       knitr_1.27       rappdirs_0.3.1  
#> [25] askpass_1.1      grid_3.6.2       tidyselect_0.2.5 glue_1.3.1      
#> [29] R6_2.4.1         rmarkdown_2.0    purrr_0.3.3      magrittr_1.5    
#> [33] webutils_1.0     promises_1.1.0   htmltools_0.4.0  splines_3.6.2   
#> [37] assertthat_0.2.1 mime_0.8         xtable_1.8-4     httpuv_1.5.2    
#> [41] stringi_1.4.4    openssl_1.4.1    crayon_1.3.4

Created on 2020-02-11 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.2 (2019-12-12)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       America/Los_Angeles         
#>  date     2020-02-11                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source        
#>  askpass       1.1     2019-01-13 [1] CRAN (R 3.6.1)
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.1)
#>  backports     1.1.5   2019-10-02 [1] CRAN (R 3.6.1)
#>  callr         3.4.0   2019-12-09 [1] CRAN (R 3.6.1)
#>  cli           2.0.0   2019-12-09 [1] CRAN (R 3.6.1)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.1)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.2)
#>  devtools      2.2.1   2019-09-24 [1] CRAN (R 3.6.2)
#>  digest        0.6.23  2019-11-23 [1] CRAN (R 3.6.1)
#>  distcomp    * 1.2     2020-02-12 [1] local         
#>  dplyr         0.8.3   2019-07-04 [1] CRAN (R 3.6.1)
#>  ellipsis      0.3.0   2019-09-20 [1] CRAN (R 3.6.1)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.1)
#>  fansi         0.4.0   2018-10-05 [1] CRAN (R 3.6.1)
#>  fastmap       1.0.1   2019-10-08 [1] CRAN (R 3.6.2)
#>  fs            1.3.1   2019-05-06 [1] CRAN (R 3.6.1)
#>  glue          1.3.1   2019-03-12 [1] CRAN (R 3.6.1)
#>  highr         0.8     2019-03-20 [1] CRAN (R 3.6.1)
#>  htmltools     0.4.0   2019-10-04 [1] CRAN (R 3.6.1)
#>  httpuv        1.5.2   2019-09-11 [1] CRAN (R 3.6.2)
#>  httr          1.4.1   2019-08-05 [1] CRAN (R 3.6.1)
#>  jsonlite      1.6     2018-12-07 [1] CRAN (R 3.6.1)
#>  knitr         1.27    2020-01-16 [1] CRAN (R 3.6.2)
#>  later         1.0.0   2019-10-04 [1] CRAN (R 3.6.2)
#>  lattice       0.20-38 2018-11-04 [2] CRAN (R 3.6.2)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.1)
#>  Matrix        1.2-18  2019-11-27 [2] CRAN (R 3.6.2)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.2)
#>  mime          0.8     2019-12-19 [1] CRAN (R 3.6.2)
#>  opencpu     * 2.1.5   2020-01-08 [1] CRAN (R 3.6.2)
#>  openssl       1.4.1   2019-07-18 [1] CRAN (R 3.6.1)
#>  pillar        1.4.2   2019-06-29 [1] CRAN (R 3.6.1)
#>  pkgbuild      1.0.6   2019-10-09 [1] CRAN (R 3.6.2)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 3.6.1)
#>  pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.6.2)
#>  prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.6.1)
#>  processx      3.4.1   2019-07-18 [1] CRAN (R 3.6.1)
#>  promises      1.1.0   2019-10-04 [1] CRAN (R 3.6.2)
#>  ps            1.3.0   2018-12-21 [1] CRAN (R 3.6.1)
#>  purrr         0.3.3   2019-10-18 [1] CRAN (R 3.6.1)
#>  R6            2.4.1   2019-11-12 [1] CRAN (R 3.6.1)
#>  rappdirs      0.3.1   2016-03-28 [1] CRAN (R 3.6.2)
#>  Rcpp          1.0.3   2019-11-08 [1] CRAN (R 3.6.1)
#>  remotes       2.1.0   2019-06-24 [1] CRAN (R 3.6.2)
#>  rlang         0.4.2   2019-11-23 [1] CRAN (R 3.6.1)
#>  rmarkdown     2.0     2019-12-12 [1] CRAN (R 3.6.2)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.2)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.2)
#>  shiny         1.4.0   2019-10-10 [1] CRAN (R 3.6.2)
#>  stringi       1.4.4   2020-01-09 [1] CRAN (R 3.6.2)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 3.6.1)
#>  survival    * 3.1-8   2019-12-03 [2] CRAN (R 3.6.2)
#>  testthat      2.3.1   2019-12-01 [1] CRAN (R 3.6.2)
#>  tibble        2.1.3   2019-06-06 [1] CRAN (R 3.6.1)
#>  tidyselect    0.2.5   2018-10-11 [1] CRAN (R 3.6.1)
#>  usethis       1.5.1   2019-07-04 [1] CRAN (R 3.6.2)
#>  webutils      1.0     2019-08-21 [1] CRAN (R 3.6.2)
#>  withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.1)
#>  xfun          0.12    2020-01-13 [1] CRAN (R 3.6.2)
#>  xtable        1.8-4   2019-04-21 [1] CRAN (R 3.6.2)
#>  yaml          2.2.0   2018-07-25 [1] CRAN (R 3.6.0)
#> 
#> [1] C:/Users/crame/Documents/R/win-library/3.6
#> [2] C:/Program Files/R/R-3.6.2/library

I believe the issue is because of changes from v1.2 or v1.1 to v1.3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.