absolute_path: Get the absolute path of a file name

Description Usage Arguments Value Author(s) See Also Examples

Description

Get the absolute path of a file name

Usage

1
absolute_path(filename)

Arguments

filename

character string - file name

Value

character string - absolute path of file name

Author(s)

Thomas P. Harte

See Also

path, dirname, basename

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  make_filename<- function() {
      if (.Platform$OS.type=="windows") {
          filename<- "u:/foo/bar.csv"
      }
      else if (.Platform$OS.type=="unix") {
          filename<- "~/foo/bar.csv"
      }
      else {
          stop(sprintf("%s not recognized", .Platform$OS.type))
      }

      filename
  }
  (filename<- make_filename())
  absolute_path(filename)

tharte/tutils documentation built on Feb. 11, 2020, 9:17 a.m.