Has anyone experienced having their plot labels cropped in knitted PDF's in Linux? This does not happen in my Windows machine.
Here is a minimal r-markdown example to replicate this problem.
---
output:
pdf_document:
keep_tex: true
---
---
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
---
---
{r pressure, echo=FALSE}
plot(pressure)
---
Here is the output.
I have submitted this as a bug report here.
sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: elementary OS 0.4.1 Loki
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats grDevices utils datasets graphics methods base
loaded via a namespace (and not attached):
[1] tseries_0.10-44 httr_1.3.1 tufte_0.3
[4] tidyr_0.8.0 jsonlite_1.5 uroot_2.0-9
[7] modelr_0.1.1 assertthat_0.2.0 TTR_0.23-3
[10] selectr_0.4-1 cellranger_1.1.0 yaml_2.1.18
[13] progress_1.2.0 pillar_1.2.2 backports_1.1.2
[16] lattice_0.20-35 glue_1.2.0 quadprog_1.5-5
[19] digest_0.6.15 rvest_0.3.2 colorspace_1.3-2
[22] htmltools_0.3.6 plyr_1.8.4 psych_1.8.3.3
[25] timeDate_3043.102 pkgconfig_2.0.1 broom_0.4.4
[28] haven_1.1.1 purrr_0.2.4 scales_0.5.0.9000
[31] git2r_0.21.0 tibble_1.4.2 ggplot2_2.2.1.9000
[34] withr_2.1.2 urca_1.3-0 nnet_7.3-12
[37] ansistrings_1.0.0.9000 lazyeval_0.2.1 cli_1.0.0.9002
[40] quantmod_0.4-13 mnormt_1.5-5 magrittr_1.5
[43] crayon_1.3.4 readxl_1.1.0 memoise_1.1.0
[46] evaluate_0.10.1 nlme_3.1-131.1 forcats_0.3.0
[49] xts_0.10-2 xml2_1.2.0 foreign_0.8-69
[52] rsconnect_0.8.8 tools_3.4.4 prettyunits_1.0.2
[55] hms_0.4.2 stringr_1.3.0 munsell_0.4.3
[58] bindrcpp_0.2.2 compiler_3.4.4 rlang_0.2.0.9001
[61] grid_3.4.4 rstudioapi_0.7 labeling_0.3
[64] rmarkdown_1.9 gtable_0.2.0 fracdiff_1.4-2
[67] curl_3.2 reshape2_1.4.3 R6_2.2.2
[70] zoo_1.8-1 lubridate_1.7.4 knitr_1.20
[73] dplyr_0.7.4 utf8_1.1.3 bindr_0.1.1
[76] rprojroot_1.3-2 readr_1.1.1 stringi_1.1.7
[79] parallel_3.4.4 Rcpp_0.12.16 lmtest_0.9-36
Related
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 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
I'm trying to get my figure captions to work but i have some problems. Either my captions won't work properly or my header will show under the figure.
I have tried will \newpage, \pagebreak, \ at all possible positions, fig.pos, fig.height and fig.width but nothing seems to work. Can't get both the caption to show and the header over the figure.
This is my code:
output: pdf_document
fig_caption: yes
graphics: yes
keep_tex: yes
---
### Header(Will get under the plot in the pdf)
```{r plot, fig.cap="Hello World!"}
ggplot(data, aes(x=x, y=y)) + geom+point()
```
Text text text text text text text
sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14
Matrix products: default
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggfortify_0.4.6 ggplot2_2.2.1 dplyr_0.7.4 knitr_1.17 pxweb_0.9.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 bindr_0.1 compiler_3.4.2 highr_0.6 plyr_1.8.4 tools_3.4.2
[7] digest_0.6.18 gtable_0.2.0 jsonlite_1.5 evaluate_0.10.1 tibble_1.3.4 checkmate_1.8.5
[13] viridisLite_0.2.0 pkgconfig_2.0.1 rlang_0.1.4 rstudioapi_0.7 curl_3.1 yaml_2.1.14
[19] bindrcpp_0.2 gridExtra_2.3 httr_1.3.1 stringr_1.2.0 xml2_1.2.0 hms_0.4.2
[25] grid_3.4.2 rprojroot_1.3-2 webshot_0.5.1 glue_1.2.0 data.table_1.10.4-3 R6_2.2.2
[31] rmarkdown_1.8 RJSONIO_1.3-0 purrr_0.2.4 tidyr_0.7.2 readr_1.1.1 magrittr_1.5
[37] backports_1.1.1 scales_0.5.0 htmltools_0.3.6 assertthat_0.2.0 rvest_0.3.2 colorspace_1.3-2
[43] stringi_1.1.6 lazyeval_0.2.1 munsell_0.4.3
I'm not able to reproduce your problem, #Oscar. I did have to adjust your code slightly to get it to work:
---
output: pdf_document
fig_caption: yes
graphics: yes
keep_tex: yes
---
### Header(Will get under the plot in the pdf)
```{r plot, fig.cap="Hello World!"}
library(ggplot2)
ggplot(mtcars, aes(x=mpg, y=cyl)) + geom_point()
```
My sessionInfo:
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 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] scales_1.0.0 ggpubr_0.2 magrittr_1.5 lubridate_1.7.4 forcats_0.4.0 purrr_0.3.0
[7] readr_1.3.1 tibble_2.0.1 tidyverse_1.2.1 broom_0.5.1 xlsx_0.6.1 gridExtra_2.3
[13] stringr_1.4.0 ggplot2_3.1.0 tidyr_0.8.2 dplyr_0.8.0.1 plyr_1.8.4 knitr_1.21
loaded via a namespace (and not attached):
[1] tidyselect_0.2.5 xfun_0.4 rJava_0.9-10 haven_2.1.0 lattice_0.20-38
[6] colorspace_1.4-0 generics_0.0.2 htmltools_0.3.6 yaml_2.2.0 rlang_0.3.1
[11] pillar_1.3.1 glue_1.3.0 withr_2.1.2 RColorBrewer_1.1-2 modelr_0.1.4
[16] readxl_1.3.0 cellranger_1.1.0 munsell_0.5.0 gtable_0.2.0 rvest_0.3.2
[21] evaluate_0.13 labeling_0.3 xlsxjars_0.6.1 highr_0.7 Rcpp_1.0.0
[26] backports_1.1.3 jsonlite_1.6 hms_0.4.2 digest_0.6.18 stringi_1.3.1
[31] grid_3.5.1 cli_1.0.1 tools_3.5.1 lazyeval_0.2.1 crayon_1.3.4
[36] pkgconfig_2.0.2 xml2_1.2.0 assertthat_0.2.0 rmarkdown_1.11 httr_1.4.0
[41] rstudioapi_0.9.0 R6_2.4.0 nlme_3.1-137 compiler_3.5.1
When I try to render an rmarkdown file with a ggplot image, all the chunks work that do not contain a ggplot image and it fails without an error when it tries to run said chunk.
The output I get in my terminal is
Killed
It runs fine on my local machine with the latest version of R and all the packages updated.
Below is the environment I am using in docker to try to run the same thing (when it fails).
R version 3.4.1 (2017-06-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Amazon Linux AMI 2017.09
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bindrcpp_0.2.2 blogdown_0.10 rmarkdown_1.11 here_0.1
[5] PRROC_1.3.1 DT_0.5 forcats_0.3.0
stringr_1.3.1
[9] dplyr_0.7.8 purrr_0.2.5 readr_1.3.1
tidyr_0.8.2
[13] tibble_2.0.1 ggplot2_3.1.0 tidyverse_1.2.1
data.table_1.12.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 lubridate_1.7.4 lattice_0.20-35
assertthat_0.2.0
[5] rprojroot_1.3-2 digest_0.6.18 mime_0.6 R6_2.3.0
[9] cellranger_1.1.0 plyr_1.8.4 backports_1.1.3 evaluate_0.12
[13] httr_1.4.0 pillar_1.3.1 rlang_0.3.1
lazyeval_0.2.1
[17] readxl_1.2.0 rstudioapi_0.9.0 Matrix_1.2-10
reticulate_1.10
[21] htmlwidgets_1.3 munsell_0.5.0 shiny_1.2.0 broom_0.5.1
[25] compiler_3.4.1 httpuv_1.4.5.1 modelr_0.1.2 xfun_0.4
[29] pkgconfig_2.0.2 htmltools_0.3.6 tidyselect_0.2.5 crayon_1.3.4
[33] withr_2.1.2 later_0.7.5 grid_3.4.1 nlme_3.1-131
[37] jsonlite_1.6 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
[45] xml2_1.2.0 generics_0.0.2 tools_3.4.1 glue_1.3.0
[49] hms_0.4.2 crosstalk_1.0.0 yaml_2.2.0
colorspace_1.4-0
[53] rvest_0.3.2 knitr_1.21 bindr_0.1.1 haven_2.0.0
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