The problem is that I'm trying to create a path to use with a system() call, and the command window will not work with the forward slash, only with the standard backslash. I do understand that within R it will work with either way, but not via the system call. I'm trying to create a "generic" system() call that will work with an external executable that is available on both windows and unix machines.
--j On Tue, Jun 28, 2011 at 10:02 PM, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > Windows will work with either separator. > --------------------------------------------------------------------------- > Jeff Newmiller The ..... ..... Go Live... > DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/Batteries O.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --------------------------------------------------------------------------- > Sent from my phone. Please excuse my brevity. > > Jonathan Greenberg <greenb...@ucdavis.edu> wrote: >> >> Thanks Henrik, but as the help for this function states: >> >> Note >> The components are separated by / (not \) on Windows. >> >> , the slashes it uses are incorrect for use in a CMD window on a >> Windows box (they need to be \ but file.path uses /). I suppose I can >> do a query as to whether the platform is Windows (in which case use \) >> or other (in which case use /) -- there isn't a more "clever" way of >> doing this? >> >> --j >> >> On Tue, Jun 28, 2011 at 7:10 PM, Henrik Bengtsson <h...@biostat.ucsf.edu> >> wrote: >> > See file.path(). >> > >> > /Henrik >> > >> > On Tue, Jun 28, 2011 at 6:59 PM, Jonathan Greenberg >> > <greenb...@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 S >> hields >> Avenue >> >> Davis, CA 95616 >> >> Phone: 415-763-5476 >> >> AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 >> >> >> >> >> ________________________________ >> >> R-help@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. >> >> >> > >> >> >> >> -- >> 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: jgrn...@hotmail.com, Gchat: jgrn307 >> >> ________________________________ >> R-help@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. > -- 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: jgrn...@hotmail.com, Gchat: jgrn307 ______________________________________________ R-help@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.