New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"~/Desktop" for setwd() isn't the OS standard Desktop in Windows #435

Open
rgaiacs opened this Issue Sep 13, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@rgaiacs
Contributor

rgaiacs commented Sep 13, 2018

As mentioned in https://carpentries.topicbox.com/groups/discuss/Tdeb023c3d8873d39-M4f43fa22d3ee362bf2d9fca9/r-setwd-desktop-in-windows and confirmed by Ashwin Srinath and Pariksheet Nanda, the use of

setwd("~/Desktop")

in Windows, can send users to one folder that isn't one Desktop folder that isn't the same as the one they normally see.

We should add a note to this on the Instructors Note or a call out box on the lesson itself (when we introduce setwd(), see #332).

@psolymos

This comment has been minimized.

psolymos commented Sep 13, 2018

This is related to how R defines home folder after tilde expansion. On Windows it is C://Users//Foo//Documents// instead of C://Users//Foo//. You can put something like this in etc/Rprofile.site:

if (.Platform$OS.type == "windows") {
    Sys.setenv(R_USER="C://Users//Foo//")
    setwd("~")
}

although this has a side effect when calling R from a directory, or using an R project in Rstudio -- you'll still end up in C://Users//Foo//.

@hoytpr

This comment has been minimized.

hoytpr commented Sep 13, 2018

when R is installed on a Windows machine, the default start icon parameters are:

"C:\Program Files\R\R-3.5.0\bin\i386\Rgui.exe" --cd-to-userdocs

So the fix seems to be to tell Windows users to fix their start icon properties. Change the "start" path to

"C:\Program Files\R\R-3.5.0\bin\x64\Rgui.exe" 

(or to wherever they installed R). Then ALSO change the "Start in:" path to

"C:\Users\Foo\Desktop" 

(obviously not using "Foo" but the users actual username). Then R will start at the users Desktop every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment