Unpacking error () when using R

I am new to the R programming language, and I have major problems with it. I want to unzip a file, but it could not work for me.

Here is the code I entered:

untar ("CD_data.tar", exdir = "data")

Then it returns the following error message:

/bin/sh: /usr/bin/gnutar: No such file or directory Warning message: In untar("CD_data.tar", exdir = "data") : '/usr/bin/gnutar -xf 'CD_data.tar' -C 'data'' returned error code 127 

Please, help! Thanks!

+6
source share
2 answers

R on OS X 10.9 (Mavericks) seems to set the wrong TAR environment variable.

You can fix this by adding the following to your .Rprofile (or by doing it manually):

 Sys.setenv(TAR = '/usr/bin/tar') 

Alternatively, you can specify the TAR path as an argument when calling untar .

+6
source

My 2 cents is that you use mac and did not install tar. You get the value 127 because the command was not found in your $ PATH, and it is not a built-in command (which usually takes place if you were on unix ...

In other words, you need to install tar.

Or run it on Linux.

-1
source

All Articles