Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / base / R / Rprofile @ 2486

History | View | Annotate | Download (5 kB)

1 2486 sjacqu01
### This is the system Rprofile file. It is always run on startup.
2 2486 sjacqu01
### Additional commands can be placed in site or user Rprofile files
3 2486 sjacqu01
#
4 2486 sjacqu01
#  Copyright (C) 1995-2012 The R Core Team
5 2486 sjacqu01
### (see ?Rprofile).
6 2486 sjacqu01
7 2486 sjacqu01
### Notice that it is a bad idea to use this file as a template for
8 2486 sjacqu01
### personal startup files, since things will be executed twice and in
9 2486 sjacqu01
### the wrong environment (user profiles are run in .GlobalEnv).
10 2486 sjacqu01
11 2486 sjacqu01
.GlobalEnv <- globalenv()
12 2486 sjacqu01
attach(NULL, name = "Autoloads")
13 2486 sjacqu01
.AutoloadEnv <- as.environment(2)
14 2486 sjacqu01
assign(".Autoloaded", NULL, envir = .AutoloadEnv)
15 2486 sjacqu01
T <- TRUE
16 2486 sjacqu01
F <- FALSE
17 2486 sjacqu01
R.version <- structure(R.Version(), class = "simple.list")
18 2486 sjacqu01
version <- R.version            # for S compatibility
19 2486 sjacqu01
20 2486 sjacqu01
## for backwards compatibility only
21 2486 sjacqu01
R.version.string <- R.version$version.string
22 2486 sjacqu01
23 2486 sjacqu01
## NOTA BENE: options() for non-base package functionality are in places like
24 2486 sjacqu01
##            --------- ../utils/R/zzz.R
25 2486 sjacqu01
26 2486 sjacqu01
options(keep.source = interactive())
27 2486 sjacqu01
options(warn = 0)
28 2486 sjacqu01
# options(repos = c(CRAN="@CRAN@"))
29 2486 sjacqu01
# options(BIOC = "http://www.bioconductor.org")
30 2486 sjacqu01
31 2486 sjacqu01
options(timeout = 60)
32 2486 sjacqu01
options(encoding = "native.enc")
33 2486 sjacqu01
options(show.error.messages = TRUE)
34 2486 sjacqu01
## keep in sync with PrintDefaults() in  ../../main/print.c :
35 2486 sjacqu01
options(scipen = 0)
36 2486 sjacqu01
options(max.print = 99999)# max. #{entries} in internal printMatrix()
37 2486 sjacqu01
options(add.smooth = TRUE)# currently only used in 'plot.lm'
38 2486 sjacqu01
options(stringsAsFactors = TRUE)
39 2486 sjacqu01
if(!interactive() && is.null(getOption("showErrorCalls")))
40 2486 sjacqu01
    options(showErrorCalls = TRUE)
41 2486 sjacqu01
42 2486 sjacqu01
local({dp <- Sys.getenv("R_DEFAULT_PACKAGES")
43 2486 sjacqu01
       if(identical(dp, "")) # marginally faster to do methods last
44 2486 sjacqu01
           dp <- c("datasets", "utils", "grDevices", "graphics",
45 2486 sjacqu01
                   "stats", "methods")
46 2486 sjacqu01
       else if(identical(dp, "NULL")) dp <- character(0)
47 2486 sjacqu01
       else dp <- strsplit(dp, ",")[[1]]
48 2486 sjacqu01
       dp <- sub("[[:blank:]]*([[:alnum:]]+)", "\\1", dp) # strip whitespace
49 2486 sjacqu01
       options(defaultPackages = dp)
50 2486 sjacqu01
    })
51 2486 sjacqu01
52 2486 sjacqu01
## Expand R_LIBS_* environment variables.
53 2486 sjacqu01
Sys.setenv(R_LIBS_SITE =
54 2486 sjacqu01
           .expand_R_libs_env_var(Sys.getenv("R_LIBS_SITE")))
55 2486 sjacqu01
Sys.setenv(R_LIBS_USER =
56 2486 sjacqu01
           .expand_R_libs_env_var(Sys.getenv("R_LIBS_USER")))
57 2486 sjacqu01
58 2486 sjacqu01
.First.sys <- function()
59 2486 sjacqu01
{
60 2486 sjacqu01
    for(pkg in getOption("defaultPackages")) {
61 2486 sjacqu01
        res <- require(pkg, quietly = TRUE, warn.conflicts = FALSE,
62 2486 sjacqu01
                       character.only = TRUE)
63 2486 sjacqu01
        if(!res)
64 2486 sjacqu01
            warning(gettextf('package %s in options("defaultPackages") was not found', sQuote(pkg)),
65 2486 sjacqu01
                    call.=FALSE, domain = NA)
66 2486 sjacqu01
    }
67 2486 sjacqu01
}
68 2486 sjacqu01
69 2486 sjacqu01
.OptRequireMethods <- function()
70 2486 sjacqu01
{
71 2486 sjacqu01
      if("methods" %in% getOption("defaultPackages")) {
72 2486 sjacqu01
        res <- require("methods", quietly = TRUE, warn.conflicts = FALSE,
73 2486 sjacqu01
                       character.only = TRUE)
74 2486 sjacqu01
        if(!res)
75 2486 sjacqu01
            warning('package "methods" in options("defaultPackages") was not found', call.=FALSE)
76 2486 sjacqu01
    }
77 2486 sjacqu01
}
78 2486 sjacqu01
79 2486 sjacqu01
if(nzchar(Sys.getenv("R_BATCH"))) {
80 2486 sjacqu01
    .Last.sys <- function()
81 2486 sjacqu01
    {
82 2486 sjacqu01
        cat("> proc.time()\n")
83 2486 sjacqu01
        print(proc.time())
84 2486 sjacqu01
    }
85 2486 sjacqu01
    ## avoid passing on to spawned R processes
86 2486 sjacqu01
    ## A system has been reported without Sys.unsetenv, so try this
87 2486 sjacqu01
    try(Sys.setenv(R_BATCH=""))
88 2486 sjacqu01
}
89 2486 sjacqu01
###-*- R -*-
90 2486 sjacqu01
91 2486 sjacqu01
## this will break if R is on a network share
92 2486 sjacqu01
.Library <- file.path(chartr("\\", "/", R.home()), "library")
93 2486 sjacqu01
.Library.site <- Sys.getenv("R_LIBS_SITE")
94 2486 sjacqu01
.Library.site <- if(!nchar(.Library.site)) file.path(R.home(), "site-library") else unlist(strsplit(.Library.site, ";"))
95 2486 sjacqu01
.Library.site <- .Library.site[file.exists(.Library.site)]
96 2486 sjacqu01
97 2486 sjacqu01
if(!nzchar(Sys.getenv("R_LIBS_USER")))
98 2486 sjacqu01
    Sys.setenv(R_LIBS_USER=
99 2486 sjacqu01
               file.path(Sys.getenv("R_USER"), "R",
100 2486 sjacqu01
                         "win-library",
101 2486 sjacqu01
                         paste(R.version$major,
102 2486 sjacqu01
                               sub("\\..*$", "", R.version$minor),
103 2486 sjacqu01
                               sep=".")
104 2486 sjacqu01
                         ))
105 2486 sjacqu01
106 2486 sjacqu01
invisible(.libPaths(c(unlist(strsplit(Sys.getenv("R_LIBS"), ";")),
107 2486 sjacqu01
                      unlist(strsplit(Sys.getenv("R_LIBS_USER"), ";"))
108 2486 sjacqu01
                      )))
109 2486 sjacqu01
110 2486 sjacqu01
local({
111 2486 sjacqu01
    popath <- Sys.getenv("R_TRANSLATIONS", "")
112 2486 sjacqu01
    if(!nzchar(popath)) {
113 2486 sjacqu01
        paths <- file.path(.libPaths(), "translations", "DESCRIPTION")
114 2486 sjacqu01
        popath <- dirname(paths[file.exists(paths)][1])
115 2486 sjacqu01
    }
116 2486 sjacqu01
    bindtextdomain("R", popath)
117 2486 sjacqu01
    bindtextdomain("R-base", popath)
118 2486 sjacqu01
    bindtextdomain("RGui", popath)
119 2486 sjacqu01
    assign(".popath", popath, .BaseNamespaceEnv)
120 2486 sjacqu01
})
121 2486 sjacqu01
122 2486 sjacqu01
if(nzchar(Sys.getenv("R_PAPERSIZE"))) {
123 2486 sjacqu01
    options(papersize = Sys.getenv("R_PAPERSIZE"))
124 2486 sjacqu01
} else {
125 2486 sjacqu01
    if(grepl("(canada|united.states)", Sys.getlocale("LC_MONETARY"),
126 2486 sjacqu01
             ignore.case = TRUE)) options(papersize = "letter")
127 2486 sjacqu01
    else options(papersize = "a4")
128 2486 sjacqu01
}
129 2486 sjacqu01
130 2486 sjacqu01
options(pager = if(length(grep("--ess", commandArgs()))) "console" else "internal",
131 2486 sjacqu01
        useFancyQuotes = (.Platform$GUI == "Rgui"),
132 2486 sjacqu01
        pdfviewer = Sys.getenv("R_PDFVIEWER", file.path(R.home("bin"), "open.exe")))
133 2486 sjacqu01
134 2486 sjacqu01
if(.Platform$GUI == "Rgui")
135 2486 sjacqu01
    Sys.setenv(GFORTRAN_STDOUT_UNIT = "-1", GFORTRAN_STDERR_UNIT = "-1")
136 2486 sjacqu01
137 2486 sjacqu01
local({
138 2486 sjacqu01
    br <- Sys.getenv("R_BROWSER", NA_character_)
139 2486 sjacqu01
    if(!is.na(br)) options(browser = br)
140 2486 sjacqu01
    tests_startup <- Sys.getenv("R_TESTS")
141 2486 sjacqu01
    if(nzchar(tests_startup)) source(tests_startup)
142 2486 sjacqu01
})