1
# pROC: Tools Receiver operating characteristic (ROC curves) with
2
# (partial) area under the curve, confidence intervals and comparison. 
3
# Copyright (C) 2010-2014 Xavier Robin, Alexandre Hainard, Natacha Turck,
4
# Natalia Tiberti, Frédérique Lisacek, Jean-Charles Sanchez
5
# and Markus Müller
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19

20
.onLoad <- function(lib, pkg) {
21
  # Generate progressbar option with smart default values
22 33
  if (is.null(getOption("pROCProgress"))) {
23 33
    if (interactive()) {
24 0
      if (!is.null(getOption("STERM")) && getOption("STERM") == "iESS")
25 0
        options("pROCProgress" = list(name = "text", width = NA, char = "=", style = 1))
26 0
      else if (.Platform$OS.type == "windows")
27 0
        options("pROCProgress" = list(name = "win", width = 300))
28
      else
29 0
        options("pROCProgress" = list(name = "text", width = NA, char = "=", style = 3))
30
    }
31
    else {
32 33
      options("pROCProgress" = list(name = "none"))
33
    }
34
  }
35
}
36

37
.parseRcppVersion <- function(rcpp.version) {
38
  # Parses Rcpp version integer into a string.
39
  # Eg "65538" -> "1.0.2"
40 33
  rcpp.version <- as.integer(rcpp.version)
41 33
  major <- rcpp.version %/% 65536
42 33
  rcpp.version <- rcpp.version - major * 65536
43 33
  minor <- rcpp.version %/% 256
44 33
  rcpp.version <- rcpp.version - minor * 256
45 33
  rev <- rcpp.version
46 33
  return(sprintf("%s.%s.%s", major, minor, rev))
47
}
48

49
.checkRcppVersion <- function() {
50
  # Check runtime version of Rcpp is the same than we had at compile time
51 33
  runtime_version <- package_version(utils::packageVersion("Rcpp"))
52 33
  build_version <- package_version(.parseRcppVersion(RcppVersion()))
53 33
  if (runtime_version != build_version) {
54 33
    warning(sprintf("It seems pROC was compiled with Rcpp version %s, but %s is available now. Please re-install pROC to avoid problems: install.packages(\"pROC\").",
55 33
                    build_version,runtime_version))
56
  }
57
}
58

59
.onAttach <- function(lib, pkg) {
60 33
  packageStartupMessage("Type 'citation(\"pROC\")' for a citation.")
61
}

Read our documentation on viewing source code .

Loading