File: src.s

package info (click to toggle)
hmisc 5.2-4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,044 kB
  • sloc: asm: 28,905; f90: 590; ansic: 415; xml: 160; fortran: 75; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 482 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
##Function to source(x) if x is given, or source(last x given) otherwise
##Last x is stored in options() last.source.   x is unquoted with .s omitted.
##Author: Frank Harrell  19May91

src <- function(x) {
  if(!missing(x)) {
    y <- paste(as.character(substitute(x)),".s",sep="")
    options(last.source=y, TEMPORARY=FALSE)
  }
  else y <- options()$last.source

  if(is.null(y))
    stop("src not called with file name earlier")

  source(y)
  cat(y, "loaded\n")
  invisible()
}