I have created an Rmarkdown file in which all the code chunks run properly without errors but when I knit I am getting the following error message: "Line 53 Error in metals(.) could not find function "metals""
"metals" refers to what I named the dataset I am working with and the code for this is as follows:
metals = read_excel("path/data.xlsx") %>% janitor::clean_names()
This runs without error when knitted. The knitting process halts at line 53 which I have coded as follows:
metals %>% ggplot(aes(x = col1)) + geom_histogram()
When I run this chunk it produces a histogram with no errors. I have the most recent Rstudio and base R packages, and I have updated all my packages and libraries. I am really at my wit's end trying to figure this out and any help would be appreciated, thank you.
I have tried uninstalling and re-installing Rstudio and base R, updating all my libraries and packages, and changing the working folder but none of this has worked. The libraries I have loaded in the Rmd file are tidyverse, formatR, readxl, and ggridges.