0

I set my working directory by going to the folder and clicking on " Set as Working Directory" and then I add the code line to my document and afterwards i run everything however it tells me that the current working directory is another document. Do you know how can I change it for all chunks ?

enter image description here
enter image description here

I tried to add the code to my markdown so that it is applied when i run everything

sikimimi
  • 1
  • 2
  • Changing the working directory is generally considered to be [poor practice](https://stackoverflow.com/questions/73489216/choose-working-directory-in-code-option-of-r-chunk#73489216). – Limey Dec 05 '22 at 16:48
  • What do you mean by poor practice ? – sikimimi Dec 05 '22 at 17:04
  • Even when i run this function to know what is my directory it tells me that it is "/Users/pret/Desktop/dsiba_project 5.12.22/data". How can i change it ? – sikimimi Dec 05 '22 at 17:05
  • Note that rmarkdown documents are compiled in new. fresh R sessions and do not inherit working directories from your current interactive session. Where is your data in relation to the markdown document? Are you using RStudio projects? Or how are you organizing your scripts/data/documents? – MrFlick Dec 05 '22 at 18:22
  • It's a little hard to tell from your screen shots, but it literally looks like two different folders, one "data" and the other "report". You're on the right track with setting the working directory. As a test, you could create a new folder and put everything in it - CSV and R files - and try again? – thomasswilliams Dec 06 '22 at 11:33
  • Thank you very much folks , i created a new folder and it is working :) – sikimimi Dec 07 '22 at 15:23

0 Answers0