Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dts

Delete trailing slash


Description

This function cleans up a path string by removing the trailing slash. This is necessary on MS Windows, file.exists(fn) fails if "/" is on end of file name. Deleting the trailing slash is thus required on Windows and it is not harmful on other platforms.

Usage

dts(name)

Arguments

name

A path

Details

All usages of file.exists(fn) in R should be revised to be multi-platform safe by writing file.exists(dts(fn)).

This version also removes repeated adjacent slashes, so that "/tmp///paul//test/" becomes "/tmp/paul/test".

Value

Same path with trailing "/" removed.

Author(s)

Paul Johnson <pauljohn@ku.edu>


kutils

Project Management Tools

v1.70
GPL-2
Authors
Paul Johnson [aut, cre], Benjamin Kite [aut], Charles Redmon [aut], Jared Harpole [ctb], Kenna Whitley [ctb], Po-Yi Chen [ctb], Shadi Pirhosseinloo [ctb]
Initial release
2020-04-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.