Hi, all,
Is there an R-command that will convert shell("cd") to a string, so
that I can use it in the paste() command?
Much appreciated,
Art
Converting shell("cd") to a string
3 messages · Arthur Roberts, Duncan Murdoch, Martin Maechler
Arthur Roberts wrote:
Hi, all,
Is there an R-command that will convert shell("cd") to a string, so
that I can use it in the paste() command?
shell("cd", intern=TRUE) or getwd().
Duncan Murdoch
"AR" == Arthur Roberts <aroberts99163 at yahoo.com>
on Fri, 26 Sep 2008 01:54:59 -0700 writes:
AR> Hi, all,
AR> Is there an R-command that will convert shell("cd") to a string, so
AR> that I can use it in the paste() command?
I'm pretty sure that for the specific case, you should use
setwd() and or getwd()
which work platform-independently.
For the general case, note that shell() is windows-only whereas
the similar (but different!) function system() is defined for
all platforms and it has a second argument 'intern' which when
set to TRUE returns the result "R internally", i.e. as a
character, so the answer to your first question might be
system("cd", intern=TRUE)
Martin