Numeric type, I can’t do a range

Asked

Viewed 37 times

-3

Good afternoon. I’m doing a simple range, and returns me NA. Any hints?

is.numeric(df_1$VLR_FTRMTO)
#[1] TRUE
range(df_1$VLR_FTRMTO)
#[1] NA NA
head(df_1$VLR_FTRMTO)
#[1] 36627192 13165967 63455580 10001774 16173720 75503974
typeof(df_1$VLR_FTRMTO)
#[1] "double"
  • 1

    Try range(df_1$VLR_FTRMTO, na.rm = TRUE, finite = TRUE).

1 answer

4


Just have an NA in the vector to range back c(NA, NA).

The minimum example is this.

vetor <- c(1, NA, 3)
range(vetor)
# [1] NA NA

To correct this, use the argument na.rm. Thus

range(vetor, na.rm = TRUE)
# [1] 1 3

Browser other questions tagged

You are not signed in. Login or sign up in order to post.