R system

Sys.getlocale()

Sys.getlocale()
## [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8"

System

Sys.info()
##                                                                                           sysname 
##                                                                                          "Darwin" 
##                                                                                           release 
##                                                                                          "19.3.0" 
##                                                                                           version 
## "Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64" 
##                                                                                          nodename 
##                                                                       "Guo-Bos-MacBook-Pro.local" 
##                                                                                           machine 
##                                                                                          "x86_64" 
##                                                                                             login 
##                                                                                            "root" 
##                                                                                              user 
##                                                                                            "gc5k" 
##                                                                                    effective_user 
##                                                                                            "gc5k"
names(.Platform)
## [1] "OS.type"    "file.sep"   "dynlib.ext" "GUI"        "endian"    
## [6] "pkgType"    "path.sep"   "r_arch"
getOption("repos")
##                                CRAN 
## "https://mirrors.ustc.edu.cn/CRAN/"
Sys.getenv("R_LIBS_USER")
## [1] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library"
Sys.setenv(R_LIBS_USER="/Library/Frameworks/R.framework/Versions/3.6/Resources/library")

Lib Path

.libPaths()
## [1] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library"

R version

R.version
##                _                           
## platform       x86_64-apple-darwin15.6.0   
## arch           x86_64                      
## os             darwin15.6.0                
## system         x86_64, darwin15.6.0        
## status                                     
## major          3                           
## minor          6.2                         
## year           2019                        
## month          12                          
## day            12                          
## svn rev        77560                       
## language       R                           
## version.string R version 3.6.2 (2019-12-12)
## nickname       Dark and Stormy Night

R home

R.home()
## [1] "/Library/Frameworks/R.framework/Resources"
tempdir()
## [1] "/var/folders/vv/05ybzm_j1lvglv684n98r6vc0000gn/T//RtmpNmLFyK"

CRAN setup

#chooseCRANmirror()

CRANList=getCRANmirrors()

head(CRANList)
##                              Name   Country      City
## 1                 0-Cloud [https]   0-Cloud   0-Cloud
## 2                 Algeria [https]   Algeria   Algiers
## 3            Argentina (La Plata) Argentina  La Plata
## 4    Australia (Canberra) [https] Australia  Canberra
## 5 Australia (Melbourne 1) [https] Australia Melbourne
## 6 Australia (Melbourne 2) [https] Australia Melbourne
##                                      URL
## 1           https://cloud.r-project.org/
## 2                 https://cran.usthb.dz/
## 3 http://mirror.fcaglp.unlp.edu.ar/CRAN/
## 4                 https://cran.csiro.au/
## 5 https://mirror.aarnet.edu.au/pub/CRAN/
## 6        https://cran.ms.unimelb.edu.au/
##                                                                         Host
## 1 Automatic redirection to servers worldwide, currently sponsored by Rstudio
## 2                     University of Science and Technology Houari Boumediene
## 3                                           Universidad Nacional de La Plata
## 4                                                                      CSIRO
## 5                                                                     AARNET
## 6              School of Mathematics and Statistics, University of Melbourne
##                                                                 Maintainer OK
## 1                                                     winston # stdout.org  1
## 2                                        Boukala m c <mboukala # usthb.dz>  1
## 3                                             esuarez # Fcaglp.unlp.edu.ar  1
## 4 ben.tan # csiro.au, Jayesh.joshi # csiro.au, CSIROServiceDesk # csiro.au  1
## 5                                               <sysadmin # aarnet.edu.au>  1
## 6                                          unix-ops # lists.unimelb.edu.au  1
##   CountryCode                                              Comment
## 1          us                            secure_mirror_from_master
## 2          dz                            secure_mirror_from_master
## 3          ar                                                     
## 4          au                            secure_mirror_from_master
## 5          au                            secure_mirror_from_master
## 6          au secure_mirror_from_master,maintainer_address_bounces
rCRAN <- getOption("repos")

rCRAN["CRAN"] <- "https://mirrors.ustc.edu.cn/CRAN/"

options(repos=rCRAN)

Normalized Path

cat(normalizePath(c(R.home(), tempdir())), sep = "\n")
## /Library/Frameworks/R.framework/Versions/3.6/Resources
## /private/var/folders/vv/05ybzm_j1lvglv684n98r6vc0000gn/T/RtmpNmLFyK

Session information

sessionInfo()
## R version 3.6.2 (2019-12-12)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Catalina 10.15.3
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] Rcpp_1.0.3
## 
## loaded via a namespace (and not attached):
##  [1] compiler_3.6.2  magrittr_1.5    tools_3.6.2     htmltools_0.4.0
##  [5] yaml_2.2.1      stringi_1.4.5   rmarkdown_2.1   knitr_1.28     
##  [9] stringr_1.4.0   xfun_0.12       digest_0.6.24   rlang_0.4.4    
## [13] evaluate_0.14

Rprofile

A file “~.Rprofile” can be defined as below to set up private setting for R session.

local({
        r <- getOption("repos")
        r["CRAN"] <- "https://mirrors.ustc.edu.cn/CRAN/"
        options(repos=r)
})

Sys.setenv(R_LIBS_USER="/Library/Frameworks/R.framework/Versions/3.6/Resources/library")
tryCatch(startup::startup(), error=function(ex) message(".Rprofile error: ", conditionMessage(ex)))

library(Rcpp)

startup package

More about the private setting up for R please refer to startup package.