I use my flash drive to store all my R csv
files but I write them from my desktop, laptop, and work computer. Is there a way to build a function that will ignore setwd
if that drive is not present?
Working_D_Noah.H1N1 <- function(){
#my work space miller lab computer
if(setwd("E:/Miller Lab/Noah.H1N1/CSV Files")) return ("E:/Miller Lab/Noah.H1N1/CSV Files")
#my desktop
else(setwd("I:/Miller Lab/Noah.H1N1/CSV Files")) return("I:/Miller Lab/Noah.H1N1/CSV Files")
#my lap top
(setwd("F:/Miller Lab/Noah.H1N1/CSV Files")) return("F:/Miller Lab/Noah.H1N1/CSV Files")
}
Working_D_Noah.H1N1
As an example, I expect that if I am on my desktop and run this code, that R will select one working directory that is available.