Specify directory with setwd()
I understand that in R to set my working directory I can do:
If mydir is a unique directory name, is there way to specify the working directory without stating dir1/dir2 ?
Sys.glob does what you want:
If you don't know how deep it's nested, you can use list.files or dir:
list.files(path="~", pattern="mydir", all.files=TRUE, full.names=TRUE, recursive=TRUE, ignore.case=FALSE, include.dirs=TRUE)