R Replace Inf with NA in Vector & Data Frame (Example) | Clean Infinite Value | is.infinite Function

preview_player
Показать описание
R code of this video:

##### Example 1
my_vec <- c(1, 7, 3, Inf, 5, Inf) # Create example vector
my_vec # Print example vector

my_vec # Print updated vector

##### Example 2
x2 = c(1, Inf, 1, Inf, 1))
my_data # Print example data frame

lapply(my_data,
my_data # Print updated data frame
Рекомендации по теме
Комментарии
Автор

Thank you so much! Any idea how this pre-processing (converting Inf to NAs) might influence Machine Learning classification exercises..?

mkklindhardt
Автор

can you please explain how the data.frame solution works?

AgustinURU
Автор

I searched a pretty long time and most code didn´t work for me. But this one with two versions (for vector and data frame) worked great. Amazing job!! :)

jurgenschmidt