A built-in function in R called setwd makes the current directory the working directory. An argument for the setwd() method is a new working directory. Use the setwd() function in R to alter the current working directory. The data directory is typically navigated using the setwd() method.