I have the R code that will create a new folder then will set the directory to the new folder. But I want to add an argument that will check whether the new folder exists in the directory if it does then it wont create the new folder.
Here is my R code
path <- getwd()
newfolder <- "New Folder"
dir.create(file.path(path, newfolder))
new_path <- file.path(path, newfolder)
setwd(new_path)
I am struggling to add the argument to achieve my goal. Can anyone help me with that?