x <- c(3, -Inf, 6.56, 9.3, NaN, 5, -Inf)
rationalize(x)
df <- data.frame(num_col = c(Inf, 3, NaN),
chr_col = c("a", "b", "c"),
stringsAsFactors = FALSE)
df
rationalize(df)
Run the code above in your browser using DataLab