Henrik Bengtsson
2016-Dec-19 16:55 UTC
[Rd] Startup process: Objects are automatically print():ed
Consider a `~/.Rprofile` file containing: print("hello") "world" invisible("!") This will output the following: [1] "hello" [1] "world" when R is started. Note that "world" is also print():ed. In contrast, if you'd source() the same file, then you'd need to use argument print.eval = TRUE to get the same behavior:> source("~/.Rprofile")[1] "hello"> source("~/.Rprofile", print.eval = TRUE)[1] "hello" [1] "world" ``` I am aware that the R startup process is special in many ways, e.g. it happens very early on and only the base package is loaded. However, is the automatic print():ing of objects by design, a side effect, or a bug? It appears to not be documented, at least not in help("Startup", package = "base"). /Henrik PS. I've got a bit of a deja vu while writing this - I might have already brought this one up many years ago.> sessionInfo()R version 3.3.2 (2016-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.1 LTS 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
Reasonably Related Threads
- RPostgreSQL [Expired connection at startup]
- source file on startup question - why does an old version of a function show up? ggplot or R?
- S4 classes and objects -- fixed structure? No...
- .Rprofile interfering with update.packages()
- qplot in ggplot2 not working any longer - (what did I do?)