# NA and NULL

# NA - data not available
# NULL - data does not exist

x<-c(12,33,52,NULL,29)

mean(x)   # Calculates with no problems

is.null(x[2])== TRUE  # Check if null

is.null(x[4])== TRUE  # Check if null

x<-c(12,33,52,NA,29)

mean(x)   # fails due to missing data

mean(x, na.rm=T)   # Calculates with no problems

is.na(x[2])== TRUE  # Check if na

is.na(x[4])== TRUE  # Check if na