Watts-College / cpp-527-fall-2021

A course shell for CPP 527 Foundations of Data Science II
https://watts-college.github.io/cpp-527-fall-2021/
2 stars 6 forks source link

Error: salary-report.rmd' does not exist when running batch.R #88

Open AmyTrumpower opened 2 years ago

AmyTrumpower commented 2 years ago

I'm not sure if I am doing this in the correct order but, I tried to run the batch.R file which has:

## 2020 REPORT

url.2020 <- "https://docs.google.com/spreadsheets/d/1RoiO9bfpbXowprWdZrgtYXG9_WuK3NFemwlvDGdym7E/export?gid=1335284952&format=csv"
rmarkdown::render( input='salary-report.rmd', 
                   output_file = "ASU-2020-Salary-Report.HTML",
                   params = list( url = url.2020 ) )`

for each year with appropriate URLs for the year.

All of the files (batch.R, salary-report.RMD, utils.R) are saved in the same folder but I'm getting the following error when I run the batch.R. It appears to be putting the correct URL in Global Environment in the Values section but produces the error when it gets to rmarkdown::render... I'm not sure where to start looking for issues on this one.

Error in abs_path(input) : The file 'salary-report.rmd' does not exist In addition: Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="salary-report.rmd": The system cannot find the file specified

lecy commented 2 years ago

The files would need to be in your current working directory.

getwd()

If not you can always set it first:

setwd( ... )

## 2020 REPORT

url.2020 <- "https://docs.google.com/spreadsheets/d/1RoiO9bfpbXowprWdZrgtYXG9_WuK3NFemwlvDGdym7E/export?gid=1335284952&format=csv"
rmarkdown::render( input='salary-report.rmd', 
                   output_file = "ASU-2020-Salary-Report.HTML",
                   params = list( url = url.2020 ) )`
AmyTrumpower commented 2 years ago

Yup...that was it. Thanks! These errors seem so obvious once they are figured out...("figuring out" = you telling me) :-)

lecy commented 2 years ago

That's what you are paying the big bucks for! Accelerated mastery through coaching (or bullying, depends on who you ask).

Dimetry-Adel commented 2 years ago

Hi Dr. @lecy,

When I run the codes of batch.R to generate the reports, it gives me this error

Quitting from lines 53-60 (salary-report.Rmd) Error in eval(expr, envir, enclos) : object 'params' not found

This is one of my codes for the report:

setwd( "..." )

## 2020 REPORT

url.2020 <- "https://docs.google.com/spreadsheets/d/1RoiO9bfpbXowprWdZrgtYXG9_WuK3NFemwlvDGdym7E/export?gid=1335284952&format=csv"
rmarkdown::render( input='salary-report.Rmd', 
                   output_file = "ASU-2020-Salary-Report.HTML",
                   params = list( url = url.2020 ) )

Thanks