WARNING: Rtools is required to build R packages but is not currently installed. Target directory already exist:

Good afternoon team,

I'm having problems with my RStudio as when I tried to install.packages on it, RStudio gives me the following message:

" > install.packages("Rtools") WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding: Using Rtools4 on Windows Installing package into ‘C:/Users/Alexander Hernandez/OneDrive/Documents/R/win-library/4.1’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘Rtools’ is not available for this version of R A version of this package for your version of R might be available elsewhere, see the ideas at R Installation and Administration"

After downloading the Rtools program and putting 'C: / Users / Alexander Hernandez / OneDrive / Documents / R / win-library / 4.1' as requested in the above message, I get the following message and I cannot surpass this error.

"Target directory already exists: C:/Users/Alexander Hernandez/OneDrive/Documents/R/win-library/4.1

Please remove previous installation or select another location"

I really appreciate all the help you can give me.

RTools is not an R package, it is a separate software that you need to download and install in your system (not in R) like you would do with any other software on Windows. That is why you get that error message.

Can you please clarify what do you mean with this?, it doesn't make much sense, Where do you "put" that folder path?

If you prefer you can try to explain yourself in Spanish, maybe it would be easier to understand what your problem actually is.

EN

Thanks andresrcs,

After I tried to install.packages and see the error I looked on the internet I found what you said

But, at the beginning of the installation of Rtools the software asked me for the destination folder. It's there where I introduce what Rstudio ask me to introduce.

And I got the message

I hope this clarifies the problem and thanks andresrcs

SP

Gracias andresrcs,

Despues de que intente install.packages y note el error busque en internet y note lo que mencionas en tu comentario

Pero, despues de descargar Rtools y al prinicipio de la instalacion, el software me pide que indique la carpet destino y es ahi donde coloco lo que Rstudio me indico

Sin embargo el mismo instalador me indica lo siguiente:

Espero esto clarifique el problems y gracias andresrcs

That is not what the error message says, you are misunderstanding it.

You are trying to install RTools into your package library folder and the installer is complaining because the folder is not empty. As I said, Rtools is not an R package so it doesn't need to (or should) be in your package library, just install it in the default location (i. e. the "Program Files" folder) like you would do with any other software.

After that, make sure to follow the rest of the installation instructions to properly configure RTools.

Putting Rtools on the PATH

After installation is complete, you need to perform one more step to be able to compile R packages: you need to put the location of the Rtools make utilities (bash, make, etc) on the PATH. The easiest way to do so is create a text file .Renviron in your Documents folder which contains the following line:

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

You can do this with a text editor, or from R like so (note that in R code you need to escape backslashes):

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

Now restart R...

Thanks andresrcs. It works perfectly.

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.