Hrstart <- c(MNC$hrstart) Hrstart mean(Hrstart) [1] NA
I wanted to get the mean of a variable (hrstart) but it keeps returning as NA.
There will be NA in your data. To get rid of them, use na.rm = TRUE:
NA
na.rm = TRUE
mean(Hrstart, na.rm = TRUE)