0

I am working on some exploratory code in Windows and R will not let me source the file I'm working on. The full file path to my code I can't disclose, but the first two directories are "T:\Projects\...\prelim_analysis.R". When I hit ctrl+shift+enter to run the file I get the following error...

Error: '\P' is an unrecognized escape in character string starting ""T:\P"

Seems the directory my file is in is causing the issue. However, I am stuck with "T:\Projects" and cannot change directories. I have reached a point where I need to debug my code as I develop my functions, and I cannot debug without being able to source my code and run it over the console. Other posts in this vein seem to have issues sourcing() external files to their code and don't touch on the issue I'm experiencing. I've written code in other directories within "T:\Projects" before and have never experienced this issue.

Phil
  • 7,287
  • 3
  • 36
  • 66
DPek
  • 180
  • 2
  • 15
  • Your code must have a string with that path in there as well. You need to properly escape the path string. Without a reproducible example, it would be very difficult to say if anything different is going on. Use `ctrl-shift-enter` basically copies everything from your editor to the console. It doesn't source the file itself. – MrFlick Jul 25 '22 at 19:50
  • @MrFlick ah thank you. Very helpful. I forgot to comment out a string to a similar directory that used the backslash. – DPek Jul 25 '22 at 19:58

0 Answers0