Created
May 8, 2019 23:35
-
-
Save LetticiaNicoli/08817f66475a4ab1f3374ec663aaf3e4 to your computer and use it in GitHub Desktop.
Special Values in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Special Values (NA, NaN, Inf e -Inf, Null) | |
#NA vs NULL | |
c(18,NA,NA,19,50) | |
c(18,NA,NULL,19,50) | |
class(NA) | |
#Create variables with special values | |
var_na = NA | |
var_nan = 0/0 | |
var_inf = 9/0 | |
var_inf_neg = -1/0 | |
var_null = NULL | |
#Create vector | |
c(var_na,var_nan,var_inf,var_inf_neg,var_null) | |
#Validations | |
is.na(var_na) | |
is.nan(var_nan) | |
is.infinite(var_inf) | |
is.infinite(var_inf_neg) | |
is.finite(var_inf) #false | |
is.null(var_null) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment