I have two functions here to just do some clean up of csv files,
function A and function B.
The logic I have is whatever .csv that function B encounters, if the dataframe doesn't have column Sales_UPDT, it should encounter an error so it should trigger , function A, but it doesn't seem to work...
It would just stop, but nothing gets triggered.
A = function(X) {
vroom(X)%>%
mutate(Sales_DT= substr(Sales, 1, 10),) %>%
write.csv(paste0(X, ".csv"), row.names = FALSE) }
B= function(X) {
vroom(X)%>%
mutate(Sales_DT= substr(Sales, 1, 10), Sales_UPDT= substr(Sales, 1, 10)) %>%
write.csv(paste0(X, ".csv"), row.names = FALSE) }
map(File,
possibly(B, otherwise =
possibly(A, otherwise = "error")
)
any help is great!