[R] Querying the path separator?

Jonathan Greenberg greenberg at ucdavis.edu
Wed Jun 29 03:59:35 CEST 2011


Hopefully this is a pretty easy fix -- I need to have R query the path
separator for some code I'm trying to write (it involves using a
system() call) -- the call requires a path and a wildcard, e.g.:

command="mycommand /path/to/*.files" in the case of unix or,
command="mycommand.exe C:\\path\\to\\*.files" on a windows box

System.which is working correctly, so the "mycommand" vs
"mycommand.exe" part is working fine.  The issue is that the /path/to
should be set to getwd(), but this strips the trailing path separator.
 How do I go about querying the correct path separator for the system,
so I can include it in a paste command (via sep=)?  Thanks!

--j

-- 
Jonathan A. Greenberg, PhD
Assistant Project Scientist
Center for Spatial Technologies and Remote Sensing (CSTARS)
Department of Land, Air and Water Resources
University of California, Davis
One Shields Avenue
Davis, CA 95616
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307



More information about the R-help mailing list