Learn R Programming

BioGeoBEARS (version 0.2.1)

addslash: Add a slash to a directory name if needed

Description

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

Usage

addslash(tmpstr)

Arguments

tmpstr
a path that you want to possibly add a slash to

Value

outstr a string of the fixed path

See Also

getwd, setwd, gsub

Examples

Run this code
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

Run the code above in your browser using DataLab