Please help, I try to sum up all the content in iris,and not sum for the non numeric variable
the code as below :
iris %>% map_dbl(function(x) if(is.numeric(x)) sum(x))
why the code is not work, it is worked if I removed the non numeric variable first, as below
iris[1:4] %>% map_dbl(function(x) if(is.numeric(x)) sum(x))