addslash: Add a slash to a directory name if needed

Description Usage Arguments Value Author(s) See Also Examples

View source: R/BioGeoBEARS_generics_v1.R

Description

This function adds a slash to the end of the string, if one is not present. Handy for standardizing paths.

Usage

1
  addslash(tmpstr)

Arguments

tmpstr

a path that you want to possibly add a slash to

Value

outstr a string of the fixed path

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

See Also

getwd, setwd, gsub

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tmpstr = "/Dropbox/_njm/__packages"
tmpstr
outstr = addslash(tmpstr)
outstr

# Annoying, getwd() often doesn't return the ending slash, which
# can make life hard for paste() later on
tmpstr = getwd()
tmpstr
outstr = addslash(tmpstr)
outstr

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.