Ah, my apologies. I was unclear how to use the list.files command with relation to writing code. I have conquered that and managed to create the tibble using the list as the content of the column:
file_list <- list.files("C:/Users/name/Documents/barca_monthly")
file_list
dataframe <- tibble(my_filenames = file_list)
dataframe
When trying to execute the remainder of the code, I get this unique warning: Error: Problem with mutate() input date_fields. x only 0's may be mixed with negative subscripts i Input date_fields is map(fields, ~.x[(length(.x) - 2):length(.x)]).
I might be confusing the placement of the strsplit() function considering this is my first time using it. I think the error may have to do with the mutate() function directly with not writing the correct "_" command of your earlier post:
dataframe <- tibble(my_filenames = file_list) %>%
mutate(fields = strsplit(my_filenames, "barca_monthly"),
date_fields = map(fields, ~ .x[(length(.x)-2): length(.x)]),
year = map_chr(date_fields, ~ .x[1]),
month = map_chr(date_fields, ~ .x[2]),
day = map_chr(date_fields, ~ .x[3]),
year = as.integer(year),
month = as.integer(month),
day = as.integer(day)) %>%
select(filenames, year:day)
Thanks for the help thus far, appreciate it!