Unable to load library sentimentr due to glue version


Here's my Rmarkdown code:

```{r cars, echo=FALSE}

I was able to install the above package but can't load the library due to the following error:

Error: package or namespace load failed for ‘sentimentr’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 namespace ‘glue’ 1.2.0 is already loaded, but >= 1.3.0 is required

I'm using Rstudio 3.5.0 and have recently installed my packages. I have tried to re-install tidyr, tidyselect, dplyr but still encounter the same error. Pls advise, thanks.

It sounds like you already have glue attached/loaded in your session, but that the sentimentr package (or one of its imported/required packages) needs a newer version of glue than the one you have. The current version of glue on CRAN is 1.3.0. So, if you start a fresh R session, and install glue from CRAN, that should take care of the error.

1 Like

Also, this kind of command should not be called inside a Rmarkdown document. You should install once outside and just load the library in the document.
When installing, do it in a clean session to avoid issues.