Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

working directory with spaces in R [closed]

Tags:

r

I am having the problem that when I use setwd() with a path that includes spaces (e.g. setwd("C:/Users/Name/My Documents/") I get the error message

"cannot change working directory"

I am a bit suprised that I did not find much about this here or on google - so it must either be a rare error or everyone knows about it I reckon. Either way, is there a why to work around it?

I am using Windows 7 and R version 3.0.2.

like image 880
erc Avatar asked Mar 20 '23 15:03

erc


2 Answers

R cannot setwd into a directory that it doesn't have 'x' (execute) permission for.

like image 154
Phil Goetz Avatar answered Mar 22 '23 05:03

Phil Goetz


This should work, but if really needed, you can use the function shortPathName.

> shortPathName("C:/Program Files (x86)/Adobe/")
[1] "C:\\PROGRA~2\\Adobe\\"
like image 31
Stéphane Laurent Avatar answered Mar 22 '23 06:03

Stéphane Laurent