Showing posts with label R Code. Show all posts
Showing posts with label R Code. Show all posts

Thursday, 1 October 2015

R code to get the column Name having null value

R Quick Solution:

Problem: What to know which columns have NULL value in dataset?

Solution:
Data set: r_data

> for(varr in names(r_data))
        {
            print(varr)
            print(sum(is.na(r_data[varr])))
        }

Output:
  [1] "SD_ID"
  [1] 0
  [1] "ZIP"
  [1] 0
  [1] "COUNTY"
  [1] 0
  [1] "LATITUDE"
  [1] 20

It means variable Latitude has 20 missing values. So you to investigate it and substitute the missing value based on your business requirement.