You can use the systemOpen() function, as in
systemOpen("C:\\Program Files")
or, to open a pdf file with your Windows-default pdf viewer
systemOpen(system.file("help","admin.pdf"))
Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com
> -----Original Message-----
> From: s-news-owner@lists.biostat.wustl.edu
> [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of
> Dennis Fisher
> Sent: Thursday, February 05, 2009 9:04 PM
> To: s-news@lists.biostat.wustl.edu
> Subject: [S] Opening a folder in Windows
>
> Colleagues,
>
> I would like to open a folder from S-Plus (8.0.4) in Windows. A
> command that works is:
> dos("start FOLDER")
> If FOLDER does not contain spaces, this is not a problem.
> However, if FOLDER contains spaces (e.g., "Program Files"), the
> command fails:
> ""Windows cannot find ..."
> the problem being that Windows attempts to execute the
> command on the
> pre-space portion of FOLDER.
>
> I have tried various means to escape the spaces -
> backslashes, single
> quotes, double quotes - to no apparent avail.
>
> I am aware that R has a command:
> shell.exec(FOLDER)
> that may address the problem.
>
> Does anyone have a simple solution to this problem, either by
> escaping
> the spaces or by allowing use of a command similar to
> shell.exec for S-
> Plus?
>
> Thanks for any assistance.
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-415-564-2220
> www.PLessThan.com
>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
>
|