Hi! Welcome!
I suspect that the problem is that file.choose()
needs to be used in an interactive session. When you knit your file via the Knit button in RStudio, knitr
runs in its own session that is not interactive. Is there a reason you can’t supply the path to the CSV instead of using file.choose()
?
(By the way, I moved this question to the #R-Markdown category because it is most likely to attract helpers with the right experience there. I also took the liberty of adding proper code formatting to your post — it’s difficult to read code that isn’t formatted as code. To do that yourself in the future, you can use the button in the posting box that looks like this: </>
(or check out this FAQ).)