Data frames and is nan

0 votes
Sum(is.na(my.df)) worked as predicted when I used it to determine whether my data frame contained any NAs, but sum(is.nan(my.df)) did not.

My.df - data.frame (a=c(1, 2, 3), b=c(5, NA, NaN)) a. my.df b
1 1 5 2 2 NA\s3 3 NaN\s> (my.df) is.na a b
[1,] TRUE TRUE [2,] TRUE FALSE [3,] TRUE FALSE > a b is.nan(my.df)
sum(is.na(my.df)) = FALSE FALSE
Sum(is.nan(my.df)) = [1] 2
[1] 0
I'm sorry. Is there a justification for the inconsistent actions? Is it a result of poor implementation, or is it deliberate? What does is.nan(my.dfreturn )'s value mean? Is there a solid reason why an entire data frame shouldn't be used with is.nan()?

The parameter types appear to be the same in the documentation for is.na() and is.nan().
Jul 20 in Data Science by avinash
• 1,840 points
8 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Data Science

0 votes
0 answers

Data frames and is.nan()

I was using sum(is.na(my.df)) to check whether ...READ MORE

Jul 22 in Data Science by avinash
• 1,840 points
8 views
0 votes
0 answers

Determine the data types of a data frame's columns

I'm using R and have loaded data ...READ MORE

Jun 1 in Data Science by avinash
• 1,840 points
16 views
0 votes
1 answer

Why is it not advisable to use attach() in R, and what should I use instead?

There is one more option that applies ...READ MORE

answered Jun 24 in Data Science by Sohail
• 2,960 points
15 views
0 votes
1 answer

How to join (merge) data frames (inner, outer, left, right)

The merge function and its optional parameters ...READ MORE

answered Jun 24 in Data Science by Sohail
• 2,960 points
22 views
0 votes
0 answers

What is the difference between rm() and rm(list=ls())?

The majority of items I've read. They ...READ MORE

Jul 5 in Data Science by avinash
• 1,840 points
9 views
0 votes
1 answer

Difference between the == and %in% operators in R

percent in percent "returns a vector of ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,960 points
20 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,610 points
434 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
478 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
4,345 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
502 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP