Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify docs about NA, NaN, and numeric #1

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

avehtari
Copy link
Owner

Originally posted to Mastodon my learning experience about NaN and NA

TIL

doc forNaN and is.nan() says: ‘NaN’ means ‘Not a Number’ and NA, ‘_Not Available_’ which is not a number as well... ->

  1. so neither is "a number".
> is.nan(c(NaN, NA))
[1]  TRUE FALSE
  1. So NaN is not "a number" and NA is not "not a number"

doc for is.numeric() doesn't mention NA nor NaN, but says ‘is.numeric’ is a more general test of an object being interpretable as numbers.

> c(is.numeric(NaN), is.numeric(NA))
[1]  TRUE FALSE
  1. So NaN is "a number", and NA is not "a number"

doc for is.na() says indicates which elements are missing.

> is.na(c(NaN, NA))
[1] TRUE TRUE
  1. So both are missing.

I feel like the documentation could be a bit more clear on these, and here is a proposal.

src/library/base/man/NA.Rd Outdated Show resolved Hide resolved
src/library/base/man/NA.Rd Outdated Show resolved Hide resolved
Copy link

@bbolker bbolker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once you've settled on a version you like, the best thing to do is to create a patch against the current SVN version and post it on https://bugs.r-project.org/ (I'm happy to do this if you like)

src/library/base/man/is.finite.Rd Outdated Show resolved Hide resolved
@avehtari
Copy link
Owner Author

@bbolker thanks for the review and fixes! I'll try submitting a patch

@avehtari
Copy link
Owner Author

@bbolker ah, I see I would need to apply for an account to be able to submit. I assume you already have an account, so please go ahead and submit it

@bbolker
Copy link

bbolker commented Mar 27, 2024

Will work on this when I get a chance.

@bbolker
Copy link

bbolker commented Mar 27, 2024

@avehtari
Copy link
Owner Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants