inst/example/complexity.R

complexity <- function(x) {
  if (x > 0.0) {
    if (x > 10.0) {
      if (x > 20.0) {
        x <- x / 2.0
      } else {
        return(x)
      }
    } else {
      return(x)
    }
  } else {
    if (x < -10.0) {
      if (x < -20.0) {
        x <- x * 2.0
      } else {
        return(x)
      }
    } else {
      return(x)
    }
  }
  x
}

Try the lintr package in your browser

Any scripts or data that you put into this service are public.

lintr documentation built on May 29, 2024, 11:31 a.m.