I am trying to read a file in which a column generally contains a double but when the value is neutral it has "Calm" as its value. So when I read the file I am using na = "Calm | calm"
and inside col_types = cols()
I am parsing the column using '9am wind speed (km/h)' = col_double()
below is my function for making tibbles.
generate_tibble <- function(filename) {
temp_tibble <- read_csv(
paste0("./data/", filename),
na = c('calm',"Calm"),
skip = 7,
col_types = cols(
'Date' = col_date(format = "%d/%m/%Y"),
'Evaporation (mm)' = col_double(),
'Sunshine (hours)' = col_double(),
'9am wind speed (km/h)' = col_double()
)
)
}
after that, I read my first file like this: main_df <- generate_tibble(file_names[1])
with which I am going to merge other files using the column names. So I run the loop using the following code.
for (i in file_names[2:length(file_names)]) {
temp <- generate_tibble(i)
main_df <- rbind(main_df, temp)
print(paste("FINISHED PARSING:", i))
}
but when I run the loop I get errors like this:
when I run problems(main_df)
it show this message:
what should I do to fix this issue? thanks in advance.