How to Get a List of Files in a Folder in R
Code
setwd("F:\\dsr\\project")
getwd()
list.files(getwd())
list.files(getwd(),pattern="*.csv")

list.files() is a function that is useful for compiling data divided into several files or for meta-programming:
path: As the first argument, if you specify a directory, it returns a list of files in that folder.pattern: As the second argument, it accepts a rule as a regular expression and returns a list of files that meet the condition. In the example, a wildcard * is used with pattern=*.csv as the rule. As you can see, the result returns a list of only*.csvfiles, ignoring other files.
