Skip to content

What does the shell() command do?

2 messages · l.chhay, Greg Snow

#
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.
#
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.