Java Mailing List Archive

http://www.r-help.com/

Home » R Help for Statistical Computing »

[R] function to compare numbers

Hyunchul Kim

2010-09-03

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi, all

is there a built-in function to compare two numbers?

something like following function

cmp <- function(x, y){
  value <- 0
  if (x > y){
    value <- 1
  }else if (x == y){
    value <- 0
  }else {
    value <- -1
  }
  return(value)
}

Thanks in advance,

Hyunchul

 [[alternative HTML version deleted]]

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
©2008 r-help.com - Jax Systems, LLC, U.S.A.