Statistics
| Revision:

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

History | View | Annotate | Download (5 kB)

1
### This is the system Rprofile file. It is always run on startup.
2
### Additional commands can be placed in site or user Rprofile files
3
#
4
#  Copyright (C) 1995-2012 The R Core Team
5
### (see ?Rprofile).
6

    
7
### Notice that it is a bad idea to use this file as a template for
8
### personal startup files, since things will be executed twice and in
9
### the wrong environment (user profiles are run in .GlobalEnv).
10

    
11
.GlobalEnv <- globalenv()
12
attach(NULL, name = "Autoloads")
13
.AutoloadEnv <- as.environment(2)
14
assign(".Autoloaded", NULL, envir = .AutoloadEnv)
15
T <- TRUE
16
F <- FALSE
17
R.version <- structure(R.Version(), class = "simple.list")
18
version <- R.version            # for S compatibility
19

    
20
## for backwards compatibility only
21
R.version.string <- R.version$version.string
22

    
23
## NOTA BENE: options() for non-base package functionality are in places like
24
##            --------- ../utils/R/zzz.R
25

    
26
options(keep.source = interactive())
27
options(warn = 0)
28
# options(repos = c(CRAN="@CRAN@"))
29
# options(BIOC = "http://www.bioconductor.org")
30

    
31
options(timeout = 60)
32
options(encoding = "native.enc")
33
options(show.error.messages = TRUE)
34
## keep in sync with PrintDefaults() in  ../../main/print.c :
35
options(scipen = 0)
36
options(max.print = 99999)# max. #{entries} in internal printMatrix()
37
options(add.smooth = TRUE)# currently only used in 'plot.lm'
38
options(stringsAsFactors = TRUE)
39
if(!interactive() && is.null(getOption("showErrorCalls")))
40
    options(showErrorCalls = TRUE)
41

    
42
local({dp <- Sys.getenv("R_DEFAULT_PACKAGES")
43
       if(identical(dp, "")) # marginally faster to do methods last
44
           dp <- c("datasets", "utils", "grDevices", "graphics",
45
                   "stats", "methods")
46
       else if(identical(dp, "NULL")) dp <- character(0)
47
       else dp <- strsplit(dp, ",")[[1]]
48
       dp <- sub("[[:blank:]]*([[:alnum:]]+)", "\\1", dp) # strip whitespace
49
       options(defaultPackages = dp)
50
    })
51

    
52
## Expand R_LIBS_* environment variables.
53
Sys.setenv(R_LIBS_SITE =
54
           .expand_R_libs_env_var(Sys.getenv("R_LIBS_SITE")))
55
Sys.setenv(R_LIBS_USER =
56
           .expand_R_libs_env_var(Sys.getenv("R_LIBS_USER")))
57

    
58
.First.sys <- function()
59
{
60
    for(pkg in getOption("defaultPackages")) {
61
        res <- require(pkg, quietly = TRUE, warn.conflicts = FALSE,
62
                       character.only = TRUE)
63
        if(!res)
64
            warning(gettextf('package %s in options("defaultPackages") was not found', sQuote(pkg)),
65
                    call.=FALSE, domain = NA)
66
    }
67
}
68

    
69
.OptRequireMethods <- function()
70
{
71
      if("methods" %in% getOption("defaultPackages")) {
72
        res <- require("methods", quietly = TRUE, warn.conflicts = FALSE,
73
                       character.only = TRUE)
74
        if(!res)
75
            warning('package "methods" in options("defaultPackages") was not found', call.=FALSE)
76
    }
77
}
78

    
79
if(nzchar(Sys.getenv("R_BATCH"))) {
80
    .Last.sys <- function()
81
    {
82
        cat("> proc.time()\n")
83
        print(proc.time())
84
    }
85
    ## avoid passing on to spawned R processes
86
    ## A system has been reported without Sys.unsetenv, so try this
87
    try(Sys.setenv(R_BATCH=""))
88
}
89
###-*- R -*-
90

    
91
## this will break if R is on a network share
92
.Library <- file.path(chartr("\\", "/", R.home()), "library")
93
.Library.site <- Sys.getenv("R_LIBS_SITE")
94
.Library.site <- if(!nchar(.Library.site)) file.path(R.home(), "site-library") else unlist(strsplit(.Library.site, ";"))
95
.Library.site <- .Library.site[file.exists(.Library.site)]
96

    
97
if(!nzchar(Sys.getenv("R_LIBS_USER")))
98
    Sys.setenv(R_LIBS_USER=
99
               file.path(Sys.getenv("R_USER"), "R",
100
                         "win-library",
101
                         paste(R.version$major,
102
                               sub("\\..*$", "", R.version$minor),
103
                               sep=".")
104
                         ))
105

    
106
invisible(.libPaths(c(unlist(strsplit(Sys.getenv("R_LIBS"), ";")),
107
                      unlist(strsplit(Sys.getenv("R_LIBS_USER"), ";"))
108
                      )))
109

    
110
local({
111
    popath <- Sys.getenv("R_TRANSLATIONS", "")
112
    if(!nzchar(popath)) {
113
        paths <- file.path(.libPaths(), "translations", "DESCRIPTION")
114
        popath <- dirname(paths[file.exists(paths)][1])
115
    }
116
    bindtextdomain("R", popath)
117
    bindtextdomain("R-base", popath)
118
    bindtextdomain("RGui", popath)
119
    assign(".popath", popath, .BaseNamespaceEnv)
120
})
121

    
122
if(nzchar(Sys.getenv("R_PAPERSIZE"))) {
123
    options(papersize = Sys.getenv("R_PAPERSIZE"))
124
} else {
125
    if(grepl("(canada|united.states)", Sys.getlocale("LC_MONETARY"),
126
             ignore.case = TRUE)) options(papersize = "letter")
127
    else options(papersize = "a4")
128
}
129

    
130
options(pager = if(length(grep("--ess", commandArgs()))) "console" else "internal",
131
        useFancyQuotes = (.Platform$GUI == "Rgui"),
132
        pdfviewer = Sys.getenv("R_PDFVIEWER", file.path(R.home("bin"), "open.exe")))
133

    
134
if(.Platform$GUI == "Rgui")
135
    Sys.setenv(GFORTRAN_STDOUT_UNIT = "-1", GFORTRAN_STDERR_UNIT = "-1")
136

    
137
local({
138
    br <- Sys.getenv("R_BROWSER", NA_character_)
139
    if(!is.na(br)) options(browser = br)
140
    tests_startup <- Sys.getenv("R_TESTS")
141
    if(nzchar(tests_startup)) source(tests_startup)
142
})