willschulz / tricordR

Twitter study management via R
MIT License
0 stars 0 forks source link

Cronjob error requires "darmoc" package which does not exist #6

Open alexikim opened 2 years ago

alexikim commented 2 years ago

Hey Will! So I've been playing around with cron tab this week. One error I keep running into is below. I've tried downloading your ALLFUNCTIONS.R file myself and commenting out the darmoc and sentiment stuff for now, but I keep hitting this same error. Where is this package from even? I cannot find it myself.

Token: 2
Users Remaining: 0
Analyzing ideology and sureness...
Loading required package: darmoc
Error in loadNamespace(x) : there is no package called 'darmoc'
Calls: scrapePanel ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'darmoc'
Execution halted

Other thing I would add to your READme --> for cron tabs to actually put the error into the .txt log you have in your tricordings folder you need to add this at the end: 2>&1 I didn't do this for a while and was not getting error messages and this seems to now work for me.

So for me this is an example cron tab entry 15 12 * /usr/local/bin/Rscript /Library/Frameworks/R.framework/Versions/4.1/Resources/library/tricordR/scripts/daily_twitter_scrape.R >> /Users/alexikim/tricordings/logs/daily_twitter_scrape_log.txt 2>&1

Also of note that I realized this week (and maybe worth noting to future users in README who have large user_id sets that take more than one day to scrape) is that running cron tabs on intervals, so like 15 12 /2 , means that it will run on every odd day of the month. So /2 (for every other day) will run on Month-Day 1, 3, 5, 7... So even if you start on day 4 of the month, it won't start scraping until day 5. I lost some time not realizing this earlier in the week.

alexikim commented 2 years ago

Also this issue is only in the scrape_timelines function, I can do crontabs for scrape_friends and scrape_followers. What I am having trouble understanding is that the error is hitting at line 1494 for me in ALLFUNCTIONS.R, but even when I comment that out AND anything associated with darmoc (despite that darmoc is default to FALSE anyways) I am still running errors.

EDIT: ok NVM. I finally figured it out. and it works!

the script (https://github.com/willschulz/tricordR/blob/main/inst/scripts/daily_twitter_scrape.R) has darmoc = TRUE as the default.... I'm switching it to FALSE for now in the main github until we figure out the darmoc package issue. this is why my commenting out of darmoc related functions from earlier was not working all along.

Let me know if you have any more input re darmoc tho! if so we can try to tackle that issue next.