I am trying to use foreach and doParallel to optimize the computation of some image processing. I have ParamIter which is the parameter to iterate over. ImageProcessing is my custom function to process the images and save the data that has been processed.
library(methods)
library(fftwtools)
library(EBImage)
library(tidyverse)
library(foreach)
library(doParallel)
registerDoParallel(20)
foreach(ParamIter = unique(AllImages$ParamIter)) %dopar% {
AllImagesTemp = AllImages[AllImages$ParamIter == ParamIter,]
ImageProcessing(Image = AllImagesTemp,
Plate = unique(AllImagesTemp$Plate),
TimePoint = unique(AllImagesTemp$TimePoint),
Marker = unique(AllImagesTemp$Marker),
Replicate = unique(AllImagesTemp$Replicate),
Well = unique(AllImagesTemp$ID),
Position = unique(AllImagesTemp$Position),
SaveDir = WellDir,
SaveParam = ParamIter,
ThrEmptyImage = .04)
}
Everything works perfectly locally on a machine with Ubuntu 18.04 and a session as per below:
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=de_DE.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=de_DE.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=de_DE.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] bindrcpp_0.2.2 fftwtools_0.9-8 doParallel_1.0.14 iterators_1.0.10 foreach_1.4.4 forcats_0.3.0 stringr_1.4.0 dplyr_0.7.7
[9] purrr_0.3.1 readr_1.1.1 tidyr_0.8.2 tibble_2.0.1 ggplot2_3.1.0 tidyverse_1.2.1 EBImage_4.24.0
loaded via a namespace (and not attached):
[1] tidyselect_0.2.5 locfit_1.5-9.1 haven_1.1.2 lattice_0.20-38 colorspace_1.4-0 htmltools_0.3.6 yaml_2.2.0
[8] rlang_0.3.1 pillar_1.3.1 withr_2.1.2 glue_1.3.0 BiocGenerics_0.28.0 modelr_0.1.2 readxl_1.1.0
[15] jpeg_0.1-8 bindr_0.1.1 plyr_1.8.4 munsell_0.5.0 gtable_0.2.0 cellranger_1.1.0 rvest_0.3.2
[22] htmlwidgets_1.3 codetools_0.2-16 broom_0.5.0 Rcpp_1.0.0 backports_1.1.3 scales_1.0.0 jsonlite_1.6
[29] abind_1.4-5 hms_0.4.2 png_0.1-7 digest_0.6.18 stringi_1.3.1 tiff_0.1-5 grid_3.5.3
[36] cli_1.0.1 tools_3.5.3 bitops_1.0-6 magrittr_1.5 RCurl_1.95-4.11 lazyeval_0.2.1 crayon_1.3.4
[43] pkgconfig_2.0.2 xml2_1.2.0 lubridate_1.7.4 assertthat_0.2.0 httr_1.4.0 rstudioapi_0.9.0 R6_2.3.0
[50] nlme_3.1-137 compiler_3.5.3
However if I am trying to do this on my local cluster it doesn't work and provides me with this error:
Error in { :
task 1 failed - "a call to callNextMethod() appears in a call to ‘.Method’, but the call does not seem to come from either a generic function or another 'callNextMethod'"
Calls: %dopar% -> <Anonymous>
Execution halted
My session on the centos cluster looks like:
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /cm/shared/apps/R/64/3.4.1/lib64/R/lib/libRblas.so
LAPACK: /cm/shared/apps/R/64/3.4.1/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] doParallel_1.0.14 iterators_1.0.10 foreach_1.4.4 forcats_0.3.0
[5] stringr_1.3.1 dplyr_0.7.8 purrr_0.3.0 readr_1.3.1
[9] tidyr_0.8.2 tibble_2.0.1 ggplot2_3.1.0 tidyverse_1.2.1
[13] EBImage_4.20.1 fftwtools_0.9-8
loaded via a namespace (and not attached):
[1] tidyselect_0.2.5 locfit_1.5-9.1 haven_2.0.0
[4] lattice_0.20-35 colorspace_1.4-0 generics_0.0.2
[7] htmltools_0.3.6 rlang_0.3.1 pillar_1.3.1
[10] withr_2.1.2 glue_1.3.0 BiocGenerics_0.24.0
[13] modelr_0.1.2 readxl_1.2.0 bindrcpp_0.2.2
[16] jpeg_0.1-8 bindr_0.1.1 plyr_1.8.4
[19] munsell_0.5.0 gtable_0.2.0 cellranger_1.1.0
[22] rvest_0.3.2 htmlwidgets_1.3 codetools_0.2-15
[25] broom_0.5.1 Rcpp_1.0.0 scales_1.0.0
[28] backports_1.1.3 jsonlite_1.6 abind_1.4-5
[31] hms_0.4.2 png_0.1-7 digest_0.6.18
[34] stringi_1.2.4 tiff_0.1-5 grid_3.4.1
[37] cli_1.0.1 bitops_1.0-6 tools_3.4.1
[40] magrittr_1.5 RCurl_1.95-4.10 lazyeval_0.2.1
[43] crayon_1.3.4 pkgconfig_2.0.2 xml2_1.2.0
[46] lubridate_1.7.4 assertthat_0.2.0 httr_1.4.0
[49] rstudioapi_0.9.0 R6_2.3.0 nlme_3.1-131
[52] compiler_3.4.1
I do not understand the error and what it is pointing me towards. Does someone have an idea of how I could solve this problem?
Upgrading to a newer version of R is not a possibility on my local cluster.
Cheers,
Mathieu
Related
I am building a shiny application with multiple actionButtons. Out of many actionButtons, two of them behave weirdly and get triggered twice everytime user clicks on it. This is only observed on 2 actionbuttons, whereas the rest function well. My initial thought was, it got triggered by some reactive variable however, I removed all my code from the observeEvent and wrote only a print statement, it still triggers it twice. Is this a know bug ?
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.9 (Maipo)
Matrix products: default
BLAS: /opt/R/3.5.2/lib64/R/lib/libRblas.so
LAPACK: /opt/R/3.5.2/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] furrr_0.1.0 future_1.14.0 shinyjs_1.0 shinyWidgets_0.4.8.910 highcharter_0.7.0
[6] lubridate_1.7.4 writexl_1.1 reshape2_1.4.3 data.table_1.12.2 forcats_0.4.0
[11] purrr_0.3.2 readr_1.3.1 tidyr_0.8.3 tibble_2.1.3 ggplot2_3.2.0
[16] tidyverse_1.2.1 dplyr_0.8.3 plyr_1.8.4 jsonlite_1.6 openxlsx_4.1.0.1
[21] shinyalert_1.0 htmlwidgets_1.3 RODBCext_0.3.1 digest_0.6.20 stringr_1.4.0
[26] DT_0.7 RODBC_1.3-15 DBI_1.0.0 fulcrumlogging_1.0.2 shiny_1.3.2
loaded via a namespace (and not attached):
[1] httr_1.4.0 bit64_0.9-7 modelr_0.1.4 assertthat_0.2.1 TTR_0.23-4 blob_1.1.1
[7] cellranger_1.1.0 yaml_2.2.0 globals_0.12.4 pillar_1.4.2 backports_1.1.4 lattice_0.20-38
[13] glue_1.3.1 rlist_0.4.6.1 promises_1.0.1 rvest_0.3.4 colorspace_1.4-1 htmltools_0.3.6
[19] httpuv_1.5.1 pkgconfig_2.0.2 broom_0.5.2 listenv_0.7.0 haven_2.1.1 xtable_1.8-4
[25] scales_1.0.0 whisker_0.3-2 later_0.8.0 generics_0.0.2 withr_2.1.2 lazyeval_0.2.2
[31] cli_1.1.0 quantmod_0.4-15 magrittr_1.5 crayon_1.3.4 readxl_1.3.1 mime_0.7
[37] nlme_3.1-137 xts_0.11-2 xml2_1.2.0 shinydashboard_0.7.1 tools_3.5.2 hms_0.4.2
[43] odbc_1.1.6 munsell_0.5.0 zip_2.0.3 compiler_3.5.2 rlang_0.4.0 grid_3.5.2
[49] rstudioapi_0.10 crosstalk_1.0.0 igraph_1.2.4.1 codetools_0.2-15 gtable_0.3.0 curl_3.3
[55] R6_2.4.0 zoo_1.8-6 bit_1.1-14 stringi_1.4.4 parallel_3.5.2 Rcpp_1.0.1
[61] tidyselect_0.2.5
library(shiny)
ui <- fluidPage(
fluidRow(
column(3, shiny::actionButton("run_calculation", "Run Calculation")),
style = "background: #034FDB;font-family: Roboto, sans-serif;font-style: normal;font-weight: normal;font-size: 18px;
line-height: 20px"
)
)
server <- function(input, output, session) {
observeEvent(input$run_calculation, {
print(1)
})
}
shinyApp(ui, server)
I got error editable from DT package
Error in if (editable) params$editable = editable :
argument is not interpretable as logical
In addition: Warning message:
In if (editable) params$editable = editable :
the condition has length > 1 and only the first element will be used
library(DT)
DT::datatable(head(iris), editable = list(
target = 'row', disable = list(columns = c(1, 3, 4)))
)
This is my R sessionInfo()
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux
Matrix products: default
BLAS: /usr/lib64/libblas.so.3.4.2
LAPACK: /usr/lib64/liblapack.so.3.4.2
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.5 readr_1.3.1 tidyr_0.8.3 tibble_2.1.1
[5] tidyverse_1.2.1 fs_1.2.7 RColorBrewer_1.1-2 rvg_0.2.0
[9] magrittr_1.5 officer_0.3.3 esquisse_0.3.0.940 scales_1.0.0
[13] colourpicker_1.0 shinyjqui_0.3.2 plotly_4.9.0 ggplot2_3.1.1
[17] forcats_0.4.0 arsenal_3.0.0 waiter_0.0.1 shinydashboardPlus_0.7.0
[21] future_1.12.0 data.table_1.12.2 shinyFiles_0.7.2 stringi_1.4.3
[25] shinyjs_1.0 shinyWidgets_0.4.8 purrr_0.3.2 rintrojs_0.2.0
[29] shinyBS_0.61 shinyalert_1.0 shinydashboard_0.7.1 stringr_1.4.0
[33] lubridate_1.7.4 dplyr_0.8.0.1 haven_2.1.0 shiny_1.3.1
loaded via a namespace (and not attached):
[1] nlme_3.1-137 httr_1.4.0 tools_3.5.3 backports_1.1.4 R6_2.4.0 lazyeval_0.2.2
[7] colorspace_1.4-1 withr_2.1.2 tidyselect_0.2.5 compiler_3.5.3 cli_1.1.0 rvest_0.3.3
[13] xml2_1.2.0 digest_0.6.18 rmarkdown_1.12 base64enc_0.1-3 pkgconfig_2.0.2 htmltools_0.3.6
[19] htmlwidgets_1.3 rlang_0.3.4 readxl_1.3.1 rstudioapi_0.10 generics_0.0.2 jsonlite_1.6
[25] crosstalk_1.0.0 zip_2.0.1 Rcpp_1.0.1 munsell_0.5.0 gdtools_0.1.8 yaml_2.2.0
[31] plyr_1.8.4 grid_3.5.3 parallel_3.5.3 listenv_0.7.0 promises_1.0.1 crayon_1.3.4
[37] miniUI_0.1.1.1 lattice_0.20-38 hms_0.4.2 knitr_1.22 pillar_1.3.1 uuid_0.1-2
[43] codetools_0.2-16 glue_1.3.1 packrat_0.5.0 evaluate_0.13 modelr_0.1.4 httpuv_1.5.1
[49] testthat_2.0.1 cellranger_1.1.0 gtable_0.3.0 assertthat_0.2.1 xfun_0.6 mime_0.6
[55] xtable_1.8-4 broom_0.5.2 later_0.8.0 rsconnect_0.8.13 viridisLite_0.3.0 tinytex_0.12
[61] globals_0.12.4 ellipsis_0.1.0
I'm using the following code to generate website for the R package:
pkgdown::build_site(
pkg = "."
, examples = TRUE
, document = TRUE
, run_dont_run = FALSE
, seed = 12345
, lazy = FALSE
, override = list()
, preview = NA
, new_process = TRUE
)
However, my R package contains a static (prebuilt) PDF vignette (Using a static (prebuilt) PDF vignette in R package) and I want to include this static (prebuilt) PDF vignette.
sessionInfo
sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pkgdown_1.3.0 PakPMICS2018hh_0.1.0 usethis_1.5.0
[4] devtools_2.0.2.9000
loaded via a namespace (and not attached):
[1] clisymbols_1.2.0 xfun_0.7 remotes_2.0.4 purrr_0.3.2
[5] rematch2_2.0.1 rcmdcheck_1.3.3 testthat_2.1.1 htmltools_0.3.6
[9] rlang_0.3.4.9003 pkgbuild_1.0.3 R.oo_1.22.0 pillar_1.4.1
[13] glue_1.3.1 withr_2.1.2 R.utils_2.8.0 xopen_1.0.0
[17] sessioninfo_1.1.1 R.cache_0.13.0 stringr_1.4.0 commonmark_1.7
[21] R.methodsS3_1.7.1 memoise_1.1.0 evaluate_0.14 knitr_1.23.2
[25] callr_3.2.0 ps_1.3.0 curl_3.3 Rcpp_1.0.1
[29] backports_1.1.4 desc_1.2.0 rversions_2.0.0 pkgload_1.0.2
[33] fs_1.3.1 R.rsp_0.43.1 digest_0.6.19 stringi_1.4.3
[37] processx_3.3.1 rprojroot_1.3-2 cli_1.1.0 tools_3.6.0
[41] magrittr_1.5 tibble_2.1.2 crayon_1.3.4 whisker_0.3-2
[45] pkgconfig_2.0.2 MASS_7.3-51.4 xml2_1.2.0.9000 prettyunits_1.0.2
[49] assertthat_0.2.1 rmarkdown_1.13 roxygen2_6.1.1 httr_1.4.0
[53] rstudioapi_0.10 R6_2.4.0 compiler_3.6.0 git2r_0.25.2
I didn't find any results on my internet calls. How to fix this error is caused?
library(ggplot2)
ggplot(data = mtcars, aes(x=disp , y=wt)) +
geom_point(stat = "identity")
result;
Error: Can't find stat called "identity"
My sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=tr_TR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=tr_TR.UTF-8 LC_COLLATE=tr_TR.UTF-8
[5] LC_MONETARY=tr_TR.UTF-8 LC_MESSAGES=tr_TR.UTF-8
[7] LC_PAPER=tr_TR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=tr_TR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_3.1.0 shiny_1.2.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 pillar_1.3.0 compiler_3.5.1
[4] cellranger_1.1.0 RColorBrewer_1.1-2 later_0.7.5
[7] plyr_1.8.4 bindr_0.1.1 forcats_0.3.0
[10] tools_3.5.1 digest_0.6.18 viridisLite_0.3.0
[13] jsonlite_1.5 tibble_1.4.2 gtable_0.2.0
[16] pkgconfig_2.0.2 rlang_0.3.0.1 ggplotgui_1.0.0
[19] rstudioapi_0.8 yaml_2.2.0 haven_1.1.2
[22] bindrcpp_0.2.2 withr_2.1.2 stringr_1.3.1
[25] httr_1.3.1 dplyr_0.7.8 htmlwidgets_1.3
[28] hms_0.4.2 grid_3.5.1 tidyselect_0.2.5
[31] data.table_1.11.8 glue_1.3.0 R6_2.3.0
[34] plotly_4.8.0 readxl_1.1.0 readr_1.1.1
[37] tidyr_0.8.2 purrr_0.2.5 magrittr_1.5
[40] scales_1.0.0 promises_1.0.1 htmltools_0.3.6
[43] assertthat_0.2.0 xtable_1.8-3 mime_0.6
[46] colorspace_1.3-2 httpuv_1.4.5 stringi_1.2.4
[49] lazyeval_0.2.1 munsell_0.5.0 crayon_1.3.4
My Rmarkdown source looks like (screenshot from RStudio):
(notice the empty lines)
When I press CTRL+Shift+k I got view as expected (with empty lines). However, if I run the chunk (evaluate) and then compile (CTRL+Shift+k), I get:
(no empty lines)
Is there any way how to preserve the empty lines in the source code? (I checked knitr options: strip.white=FALSE, tidy=TRUE, tidy.opts=list(blank=TRUE) but no joy.)
I'm using RStudio 1.0.153
Other info:
sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)
Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.19.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rvest_0.3.2 xml2_1.1.1 dplyr_0.7.1 purrr_0.2.2.2
[5] readr_1.1.1 tidyr_0.6.3 tibble_1.3.3 ggplot2_2.2.1
[9] tidyverse_1.1.1
loaded via a namespace (and not attached):
[1] pbdZMQ_0.2-6 reshape2_1.4.2 haven_1.1.0 lattice_0.20-35
[5] colorspace_1.3-2 htmltools_0.3.6 yaml_2.1.14 base64enc_0.1-3
[9] XML_3.98-1.9 rlang_0.1.1 foreign_0.8-69 glue_1.1.1
[13] selectr_0.3-1 readxl_1.0.0 modelr_0.1.0 semver_0.2.0
[17] bindrcpp_0.2 bindr_0.1 plyr_1.8.4 stringr_1.2.0
[21] cellranger_1.1.0 munsell_0.4.3 binman_0.1.0 gtable_0.2.0
[25] caTools_1.17.1 psych_1.7.5 evaluate_0.10.1 knitr_1.16
[29] forcats_0.2.0 wdman_0.2.2 curl_2.7 parallel_3.4.1
[33] broom_0.4.2 Rcpp_0.12.11 openssl_0.9.6 backports_1.1.0
[37] scales_0.4.1 formatR_1.5 RSelenium_1.7.1 jsonlite_1.5
[41] mnormt_1.5-5 hms_0.3 digest_0.6.12 stringi_1.1.5
[45] grid_3.4.1 rprojroot_1.2 tools_3.4.1 bitops_1.0-6
[49] magrittr_1.5 lazyeval_0.2.0 pkgconfig_2.0.1 lubridate_1.6.0
[53] httr_1.2.1 assertthat_0.2.0 rmarkdown_1.6 R6_2.2.2
[57] nlme_3.1-131 compiler_3.4.1
As far as I can see, you can't do that with an HTML notebook. If you don't need all the special notebook features, you can ask for an html_document instead of an html_notebook and formatting will be preserved. If you do need the notebook features, you probably need to make a feature request on the rmarkdown development page https://github.com/rstudio/rmarkdown to add this.