params not found when using knit or run all but running individual chunk works fine.

TIA, apolgies I can't post the whole rmd document (legally)

So I am using params do change to values in an rmd document. My YAML is as follows:

---
output: pdf_document
params:
  year:
    value: 2019
  trip:
    value: "trip1"  
---

Further in the code i assign these params to values:

```{r}
#select the years to work on
params$year
YEARS <- params$year

#SELECT THE TRIP
params$trip
TripID <- params$trip
```

If i run that chunk on its own it works perfectly, but if i run all or use knit it gives me the error

Error: object 'params' not found

Could there be something in the rest of the document that could be intefering? Or a peice of code I nede to add so params will work with knit etc.

Thanks for the help.

rmd file had rm(list()) to clear the GE and it was removing params. Solved now thankyou

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.