akre96/cdc_overdose

Revisions to get the code to work in RStudio

Opened this issue · 0 comments

I have finally have been able to get the code to in RStudio (more or less) in a Docker instance. Here’s a couple of changes/revisions I’ve had to make to get it to work:

  1. In regards to the python notebook, I couldn’t get it to work…

so I converted - CDC_overdose_monthly_recovery.ipynb - to a python script using the command below

CDC_overdose_monthly_recovery.ipynb --to script
Then, I opened a terminal window in RStudio and ran it with - python3 CDC_overdose_monthly_recovery.py -

  1. “CDC_monthly_recovery_analysis.R” doesn’t exist for me. So instead I reviewed/revised ,“CDC_monthly_recovery.R”

Hardcoded directories are still in the code, so it won’t run “out of the box”… Make the following changes to get things working:

  • Line 14 & 16 , change - /data/CDC_2020 to /input/
  • line 45, change - /data/CDC_2020 - to /output/
  • Line 48, change - /data/CDC_2020 to /output/
  • Line 61, change - /data/CDC_2020 to /input/
  • Line 92, change - /data/CDC_2020 - to /input/
  • Line 104, change - /data/CDC_2020 - to /output/
  • Line 458, change - /data/CDC_2020/CDC_ts_July2020.csv to /input/CDC_ts.csv
  1. The - gpclib - package needs to be installed

install.packages("gpclib", type="source")
(as per - https://stackoverflow.com/questions/30790036/error-istruegpclibpermitstatus-is-not-true )

  1. I updated the root path to /home/rstudio/cdc_overdose

The code was then able to run and generate the output files & visuals