Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisions to get the code to work in RStudio #2

Open
privaterra opened this issue Jul 5, 2021 · 0 comments
Open

Revisions to get the code to work in RStudio #2

privaterra opened this issue Jul 5, 2021 · 0 comments

Comments

@privaterra
Copy link
Contributor

privaterra commented Jul 5, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant