3

How does one identify Inf, -Inf when using SQL with sqldf?

Sample data:

x <- data.frame(val = c(1, 2, 3, Inf))

Now, I am using:

sqldf('select * from x where val < 999999999999999999999')

But this does not seem very safe.

Tomas Greif
  • 21,685
  • 23
  • 106
  • 155

1 Answers1

3

Try this:

> sqldf("select val from x where cast(val as text) != 'Inf'")
  val
1   1
2   2
3   3
G. Grothendieck
  • 254,981
  • 17
  • 203
  • 341