Skip to content

Issue running code in eva_data_analysis.R after changes to path are made #24

@jsgro

Description

@jsgro

(I have made more updates to Episode 2 and what I did today was added to the current Pull Request. Then I ran into this issue.)

What is the problem?

I saw that after the code is changed, we don't try to run it again!... This was also noted when we presented the Phython version. However, the code is not running perfectly... see details below.

EDIT: Quick fix is to move library(lubridate) to the TOP of the script... But was this an intentional error???

Location of problem (optional)

Once I made the changes to the top of the script file eva_data_analysis.R to fix the hard-coded PATHs to script and Json data, I then try to run the code 3 different ways:

  1. By using RSCRIPT eva_data_analysis.R
  2. By using source icon at the top right of Script pane in RStudio
  3. By selecting all the text and issuing Ctrl+return to run the selected code (in this case the whole page.

I always get this error: Error in Date() : could not find function "Date"

However, if I manually issue the command on line 26 library(lubridate) FIRST, I get this info:

Attaching package: ‘lubridate’
The following objects are masked from ‘package:base’:
    date, intersect, setdiff, union

AFTER that it all works well and I see the plot in the plot panel on RStudio, and also a file cumulative_eva_graph.png is visible in the directory with ls.

For the SHELL method, I can issue:

Rscript -e "library(lubridate); source('eva_data_analysis.R')"

and a file called Rplots.pdf is created and is correct.

Interestingly I do not have to do the same with library(jsonlite) on line 7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions