added na.rm value to TRUE to calculate mean