[R] What does the shell() command do?

Greg Snow Greg.Snow at imail.org
Thu Jan 13 21:26:14 CET 2011


This depends partly on what operating system you are using (the posting guide suggests including this type of information).

But basically shell will pass a command to the operating system (or a shell for unix Oss) for it to run the command.  So in your example it is expecting to run dir/b on a file in the OS, not R.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of l.chhay
> Sent: Wednesday, January 12, 2011 5:18 PM
> To: r-help at r-project.org
> Subject: [R] What does the shell() command do?
> 
> 
> Dear R community,
> 
> I am trying to understand what the shell() function does.
> 
> An example is:
> 
> xfile <- shell(paste("dir/b ",
> paste(directory.folder,"file.name",sep="")),intern=T)
> 
> I'm afraid I wasn't able to completely understand the explanation under
> the
> Help files.
> 
> Thanks for your help!
> 
> Leanne.
> --
> View this message in context: http://r.789695.n4.nabble.com/What-does-
> the-shell-command-do-tp3215032p3215032.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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