I am attempting to knit a markdown that I have been working on for Google Data Analytics Professional Certificate Capstone. I have the markdown near completed and would like to see how it delivers, however, when I attempt to knit I receive "no such file or directory" error. This was not occurring for me while working on the markdown as I was simultaneously using the knit function to the view the work. It happened when I changed the output from html_notebook to word_document. I changed it back to html_notebook and am still receiving the same error. I have provided a caption of the error message. I understand it has something to do with the directory however I have the .RMD located in the same folder as the imported data sets which I create the data frame from. I am running that code using a data frame that is in my environment so why would markdown not be able to find this data? Any help would be appreciated! Also, when I take out new_sleep_averages code it then returns the same error on my next visualization with a different data frame.
3 Answers
the issue is because
new_sleep_averages is not found. perhaps you renamed the variable name or the name does not exist.
Check Line 51, and trace where new_sleep_averages is created

- 554
- 7
- 18
-
new_sleep_averages is a dataframe within my Environment, the graph is still being produced from the data frame so it must be able to be found within R, just has some sort of problem when trying to knit – Stackstudent_09 Apr 16 '22 at 17:46
-
if you check closely, r cannot find it. your knit is fine, just that can't publish your code without solving that file issue. you will notice if you remove the line, it will work fine. – Muraino Apr 16 '22 at 17:54
-
try to observe the line of code well on that line 51.. computer don't lie – Muraino Apr 16 '22 at 17:55
-
I removed the line and then another problem appeared at line 60 when knitt.. summary(sleepday_merged_User13$TotalHoursAsleep) - again I was not having these problems earlier, it was knitting just fine before changing file formats – Stackstudent_09 Apr 16 '22 at 18:02
-
I would have said you should share picture .. but to solve this fast.. can you share a google meet link.. let me look at it and solve for you? otr you an share picture – Muraino Apr 16 '22 at 18:05
I have found the answer via another stack overflow question. Here is the link Can't resolve error in .Rmd file <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval ->
I installed this line of code at the top of my document and everything ran fine.
knitr::opts_chunk$set(error = TRUE)
-- This however did not load graphs there were still errors in the code which were solved by inputting the individual code chunks for each graph within the markdown. For example I only had
user6_hr_April12 %>%
mutate(user6_hr_April12, Time = as.POSIXct(Time, format = "%m/%d/%Y %I:%M:%OS %p")) %>%
ggplot(aes(x = Time, y = Value)) +
geom_line() +
theme_bw() +
scale_x_datetime(breaks = "1 hour", date_labels = "%I:%M %p") +
theme(axis.text.x = element_text(angle = 45)) +
ggtitle("heart rate user_6",
subtitle = "4-12-2016")
but had to input the code for read.csv and all the cleaning I did as well.

- 131
- 1
- 9
Try to remove the View(penguins) code chunk and then try to knit it. I am on the same certificate program, and I found the solution somewhere and it worked.

- 1
-
Welcome to SO! Can you expand this answer to show why `View(penguins)` is a problem/ how this solves the issue? – Michael Roswell Apr 12 '23 at 19:47