Feedback on iteration chapter (#1130)
This commit is contained in:
committed by
GitHub
parent
1b82fe4625
commit
c4cd9cecfa
@@ -284,11 +284,11 @@ With the additional `id` parameter we have added a new column called `file` to t
|
||||
This is especially helpful in circumstances where the files you're reading in do not have an identifying column that can help you trace the observations back to their original sources.
|
||||
|
||||
If you have many files you want to read in, it can get cumbersome to write out their names as a list.
|
||||
Instead, you can use the base `dir()` function to find the files for you by matching a pattern in the file names.
|
||||
Instead, you can use the base `list.files()` function to find the files for you by matching a pattern in the file names.
|
||||
You'll learn more about these patterns in @sec-strings.
|
||||
|
||||
```{r}
|
||||
sales_files <- dir("data", pattern = "sales\\.csv$", full.names = TRUE)
|
||||
sales_files <- list.files("data", pattern = "sales\\.csv$", full.names = TRUE)
|
||||
sales_files
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user