Prevost
Prevost

Reputation: 697

knitr package loading error stringr

I get the following error:

1Error in library(stringr) : Package 'stringr' version 1.2.0 cannot be unloaded

when loading the following packages in my knitr document:

library(checkpoint) checkpoint("2017-01-01") library(stringr) library(plyr) library(tidyr) library(dplyr) library(knitr) library(readr) library(readxl) library(ggplot2) library(scales) library(ggthemes) library(lubridate) library(xtable) library(zoo) library(gridExtra)

when I remove stringr then I get the error:

Error in mutate_impl(.data, dots) : could not find function "str_sub"

...any ideas? I am using Mac OSX Mavericks. I copied the files over from a Windows 7 (where it worked) and I'm assuming that has something to do with it.

Thank you in advance!

Upvotes: 1

Views: 340

Answers (1)

Kevin Arseneau
Kevin Arseneau

Reputation: 6264

There is a conflict due to the stringr package being newer (2017-02-18) than your checkpoint date of 2017-01-01.

You could clear the conflict by moving the date you use to something later, i.e.

checkpoint("2017-02-18") # or later

Alternatively, if you find you have mixed dependencies that rely on packages that were not all current on the same date, I would recommend having a look at packrat (link), which is designed for that purpose.

Upvotes: 1

Related Questions