Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in R Programming by (50.2k points)

I have implemented the following code(Kindly see the comments):

> NA.of.df = which(rowSums(is.na(df)) == ncol(df))

> NA.of.df 

named integer(0)

> fix(df) # i want to see what's in here -- nothing wrong

> NA.of.df # so i run it again  

1 3 5 7 9 # it works!

Why would this happen??

1 Answer

0 votes
by (108k points)

I think there is the issue with the quotations around the NA resulting in is.na to not pick up those elements:

is.na(c(NA, "NA"))

#[1]  TRUE FALSE

After doing the fix, it may have lost the quotes and evaluate them correctly.

If you are wondering what is R programming, then do check out the blog that will help you in clearing all your doubts.

Browse Categories

...