R/sethd.R

Defines functions sethd

Documented in sethd

#' Set home directory
#' 
#' Set home directory based on the current operating system
#' 
#' @param drive Name of drive to work from. Either "google" or "one".
#'
#' @return \code{sethd} returns the current directory before the change as in \code{setwd}.
#' 
#' @author Shona Wilde
#' 
#' @export

sethd <- function(drive = "google") {
  
  system <- Sys.info()[1]
  
  if (drive == "google")
  {
    
    if (system == "Windows") {
      
      dir <- setwd("G:/My Drive/")
      
    }
    
    if (system == "Darwin") {
      
      dir <- setwd("~/Google Drive/My Drive/")
    }
    
  }
  
  if (drive == "one") {
    
    if (system == "Windows") {
      
      dir <- setwd("C:/Users/Shona/OneDrive - Carleton University/")
      
    }
    
    if (system == "Darwin") {
      
      dir <- setwd("~/OneDrive - Carleton University/")
    }
    
  }
    
  
  
  return(invisible(dir))
  
}
shonawilde/shonarrr documentation built on Jan. 29, 2025, 1:27 a.m.