[R] Sink for a subdirectory

Jerome Asselin jerome at hivnet.ubc.ca
Thu May 8 00:29:37 CEST 2003


On May 7, 2003 03:08 pm, Duncan Murdoch wrote:
> Content-Length: 794
> Status: R
> X-Status: N
>
> On Wed, 07 May 2003 21:38:14 +0000, you wrote:
> >Hi, how do I sink output to a subdirectory under which R is running?
> >
> >For example, suppose R is running in ~me and I would like to sink
> > output to ~me/Subdir/filename.
> >
> >The obvious sink( "Subdir/filename" ) does not seem to work.
>
> It works for me.  It would be helpful if you said what goes wrong, and
> what OS you're running in.
>
> I'm guessing that Subdir doesn't exist; R won't create it.  I don't
> think there's a mkdir() function in R; you'll need to create the
> subdir outside of R, or use system() to do it.  For example, in
> Windows,
>
> system('command /c mkdir Subdir')
>
> would do it.
>
> Duncan Murdoch
>

There is a function to change the directory in R. See ?setwd .

Jerome




More information about the R-help mailing list