[R] Querying the path separator?

Henrik Bengtsson hb at biostat.ucsf.edu
Wed Jun 29 04:10:25 CEST 2011


See file.path().

/Henrik

On Tue, Jun 28, 2011 at 6:59 PM, Jonathan Greenberg
<greenberg at ucdavis.edu> wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list