I have a dataset of characters including NULL
values as "NA"
. To calculate the mean value should I omit NA or replace NA with 0?
Someone encouraged me to omit NULL
values rather replace with 0.My question is why we shouldn't replace with 0?
OmitNA<-na.omit(oswego$age) # The NA value is omitted and remaining data is stored in OmitNA
AsNum<-as.numeric(OmitNA) # OmitNA from previous step is stored as numberic in AsNum
print(mean(AsNum)) # Mean is calculated
I need a reason why I shouldn't replace NULL
with 0.