added number of NA values to function output