mcSamuelDataSci / CACommunityBurden

11 stars 11 forks source link

method to set path #55

Closed sharygin closed 5 years ago

sharygin commented 5 years ago

I expect for a lot of users the default path is not the R working directory – i.e. what is getwd() without setwd()? Currently the user has to set myDrive to the project folder in multiple files. An external local file like .path would be robust to cases where people’s starting directory is a different folder. Another option would be to have an options file like config.txt that would contain all the necessary user-specified options including this path for all scripts.

mcSamuelDataSci commented 5 years ago

Thanks Ethan. I have definitely not been clear, and have been changing some things that have not been clear to you and others, and forgot a "push" that may have made this more clear. I do think for other reasons we are going to want something like a config.txt.

But in terms of the path I believe the way I have set up things, and am requesting other do, works well and does not require editing anything in the file. For example I sometimes work on the CCB from E:\0.CBD and sometimes work on it from C:\special\rProjects\LocalCCB. Both of those folder have a .Rproj file (0.CBD.Rproj and LocalCCB.Rproj respectively). As long as I do all my work on the project by clicking one of those files (depending where I am working) to get into RStudio (which has the advantage of getting git "ready"), then the "myDrive <- getwd()" assignment at the beginning of many of my code files point to the "top" of the CCB project and any lines like those below work regardless of where the overall CCB project is located.

myPlace <- paste0(myDrive,"/myCBD") upPlace <- paste0(myDrive,"/myUpstream")

ageMap <- as.data.frame(read_excel(paste0(myPlace,"/myInfo/Age Group Standard and US Standard 2000 Population.xlsx"),sheet = "data"))

Does this make sense now? Happy to chat or WexEx tomorrow?

I am adding Ben to this, because he and I have been discussing it too.