[R] unwanted as.integer

Jack Tanner ihok at hotmail.com
Fri Jul 30 18:23:37 CEST 2004


Sundar Dorai-Raj wrote:
> Not sure about what sqlQuery is doing but you can wrap your return value 
> in a eval(parse(text = x)) to evaluate the "as.integer(.)" string. As in,
> 
> a <- eval(parse(text = a))

This works, except it doesn't.

 > a <- sqlQuery(irrdb, "select count(field) from mytable where field=1")
 > print(a)
  count(field)
1            8
 > paste(a)
[1] "as.integer(8)"
 > eval(parse(text=a))
[1] 8
 > paste(eval(parse(text=a)))
[1] "8"

That's great, but...
 > paste(list(eval(parse(text=a)), eval(parse(text=a))))
[1] "as.integer(8)" "as.integer(8)"

Argh!!! What the hell is going on?




More information about the R-help mailing list