Jonathan George
Jonathan George

Reputation: 53

*Still Stumped* Deconflicting two R Packages with same library name (sentiment and sentiment140)

I run R on a webserver and one of the packages I use is "sentiment", an old package used for sentiment analysis. I'm not even sure its still around and/or widely used. There is a new package, "sentiment140" that I would like to use on my server, but to call it, it also uses the library(sentiment) command. How can I install and use both packages?

Upvotes: 1

Views: 198

Answers (1)

das78
das78

Reputation: 181

Here is one way to do it:

I assume you have an old package already installed (e.g. the sentiment package) and you want to install a new one with the same name. We are going to trick R into thinking the name of the package is something else (whatever you want to call it).

  1. Download the source for the new package.
  2. Untar and unzip if needed.
  3. In the base directory for the package's source code, there should be a file called DESCRIPTION.
  4. Key Step --> Edit the Package: line in this file, giving it a new package name (e.g. change Package: sentiment to Package: sentiment2).
  5. From the command line, install the package. R CMD INSTALL package.

You should now be able to load the package using whatever name you chose above, e.g. library(sentiment2).

Upvotes: 0

Related Questions