1

I get correct output of the following code for Rscript code.r but damaged file when running RStudio source in the minimal project, which I do not understand. Code

pdf("test.pdf")
plot(iris)

There are quite big differences in Details of those two sessions listed following for RStudio vs R prompt. So some setting of RStudio must be wrongly configured.

  1. locale: 9 vs 11 things
  2. namespace: 1 vs 5 things

Details in RStudio session in a minimal project

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.12.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     

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0 

Details in R

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.12.so

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8    
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8   
 [7] LC_PAPER=en_US.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.0    bit_1.1-12        colorspace_1.3-2  DBI_0.7          
[5] bit64_0.9-7       data.table_1.10.4

OS: Debian 8.7
R: 3.4.0
RStudio: 1.0.143
RStudio support: here but you need to be logged in to read the thread and works in Firefox (my Google Chrome is not accepted there to get logged in)

Léo Léopold Hertz 준영
  • 6,788
  • 29
  • 91
  • 193

1 Answers1

1

This code works in RStudio where RStudio requires dev.off() for some reason

pdf("test.pdf")
plot(iris)
dev.off()
Léo Léopold Hertz 준영
  • 6,788
  • 29
  • 91
  • 193