Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identify Inf in sqldf

Tags:

r

sqldf

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.

like image 307
Tomas Greif Avatar asked Jan 25 '26 00:01

Tomas Greif


1 Answers

Try this:

> sqldf("select val from x where cast(val as text) != 'Inf'")
  val
1   1
2   2
3   3
like image 131
G. Grothendieck Avatar answered Jan 26 '26 16:01

G. Grothendieck