I’d appreciate any idea on how to do it, so we can compare them with each other.
Here is one to start out with:
is.natural <- function(x)
{
x>0 && identical(round(x), x)
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The docs suggest a similar method, so I doubt you’ll get any better. Remember to include an epsilon to take into account precision issues!