0

I'm trying to do this.

DataLocation <- "C:\Users\Documents\MyFile.csv"

> DataLocation <- "C:\Users\Documents\MyFile.csv"
Error: '\U' used without hex digits in character string starting ""C:\U"

Is there a way I can write something to read that. I need it so that it's simple enough to copy and paste the file location into the script. It doesn't matter if the it's within lengthy code. Any help greatly appreciated. Thanks

H.Cheung
  • 855
  • 5
  • 12
  • 1
    Use double slash(backward) or single slash(forward) or use r"{C:\Users\Documents\MyFile.csv}", so probably you would do something like `data <- read.csv( r"{C:\Users\Documents\MyFile.csv}")`, also datalocation <- r"{C:\Users\Documents\MyFile.csv}" – PKumar Mar 30 '21 at 11:28
  • Excellent, that works perfectly. Many thanks – H.Cheung Mar 30 '21 at 11:31

0 Answers0