store output of system command into a variable in r
Solution 1:
Use intern=TRUE
:
a <- system("ls ", intern = TRUE)
Solution 2:
why not use the corresponding R function?
a <- list.files()
b <- list.files(recursive = TRUE)
For more details
?list.files