0

I installed an R library (https://github.com/behavioral-ds/evently) using devtools::install_github()

This library (evently) is installed in Library/Frameworks/R.framework/Resources/library. On the other hand, I have the same directory (evently) in my local folder: Docs/proj (because I cloned the github URL in this local folder).

I have to run the following lines (to build retweet cascades):

library(evently)
filepath <- system.file('extdata', 'tweets_anonymized.jsonl', package = 'evently')
cascades <- parse_raw_tweets_to_cascades(filepath, progress = F)

The parse_raw_tweets_to_cascades function is in the tweet.R file. When I edit the tweet.R file and run the above lines of code, it runs the original "evently" library, and not the one I am editing (in Docs/proj)

I tried the following:

library("evently",lib.loc="~/Docs/proj/evently")

but I get the error: "there is no package called ‘evently’". How can I run the R file from the local directory?

Update/Answer

The answer provided by Konrad Rudolph worked for me. I just used devtools::load_all() instead of library(packagename).

halfer
  • 19,824
  • 17
  • 99
  • 186
mOna
  • 2,341
  • 9
  • 36
  • 60
  • 3
    You need to use `devtools::load_all()` instead of `library` to load the package. – Konrad Rudolph Mar 26 '23 at 21:15
  • 1
    ...and that's because *cloning* a Github repo does not *install* a package. – Limey Mar 26 '23 at 21:36
  • 3
    You asked this question [yesterday](https://stackoverflow.com/questions/75844640). See [this](https://meta.stackexchange.com/a/7054) Q&A on Meta about unanswered questions. – Mikael Jagan Mar 26 '23 at 23:06
  • @MikaelJagan: thanks for mentioning the Meta page. I will update my question instead of asking a new one. – mOna Mar 27 '23 at 00:55
  • @Limey: I installed the package using `devtools::install_github` (as suggested in the library github page). Also, according to the [discussions in this post](https://stackoverflow.com/questions/70101232/whats-the-difference-between-using-devtoolsinstall-github-and-cloning-a-git), `devtools::install_github` installs a package directly from git repository. The reason I used git clone was because I wanted to edit the codes. – mOna Mar 27 '23 at 01:06

0 Answers0