my_answers <- c('S+', 
                'C++',
                'Python',
                'Matlab',
                'Javascript')

#check_answers(my_answers)

Question

Within the same script, show the current working directory (see function getwd, as in print(getwd())). Now, change your working directory to Desktop (Desktop) and show the following message on the prompt screen: 'My desktop address is ....'. Tip: use and abuse of RStudio's autocomplete tool to quickly find the desktop folder.

Solution

current_dir <- getwd()
print(current_dir)

new_dir <- '~/Desktop/' # this is probably C:/Users/USERNAME/Desktop for Windows
setwd(new_dir)

cat(paste0('My desktop address is ', getwd()))

Meta-information

extype: string exsolution: r mchoice2string(c(TRUE, FALSE, FALSE, FALSE, FALSE), single = TRUE) exname: "getwd" exshuffle: TRUE



msperlin/afedR documentation built on Sept. 11, 2022, 9:49 a.m.