I want to make a function that gives me the share of missing values in a variable. I am very new to r, and I am not sure that I am doing this correctly. At this point I am really confused. The function I have so far is this:
na_prop <- function(x) {
prop_na <- mean(is.na(x))
return(prop_na)
}
It is not giving me the result I want when I use it later, what am I doing wrong? Is there a better way to make this function?