The code looks correct. What is the result of the list.files(...)
alone? What is the result of list.files(...) %>% lapply(...)
? You need to narrow things down to find exactly what part is incorrect.
Note: your code works with my fake data, so that really suggests you are looking in the wrong directory:
library(tidyverse)
# Create data
write_csv(data.frame(a = 1:3,
b = 4:6),
"test1.csv")
write_csv(data.frame(a = 1:6,
b = 4:9),
"test2.csv")
# Run
list.files(path='.', pattern = "*.csv", full.names = TRUE) %>%
lapply(read_csv) %>%
bind_rows
#> Rows: 3 Columns: 2
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): a, b
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 6 Columns: 2
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): a, b
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 9 × 2
#> a b
#> <dbl> <dbl>
#> 1 1 4
#> 2 2 5
#> 3 3 6
#> 4 1 4
#> 5 2 5
#> 6 3 6
#> 7 4 7
#> 8 5 8
#> 9 6 9
Created on 2022-07-04 by the reprex package (v2.0.1)