[R] Database-conversion

Jason Turner jasont at indigoindustrial.co.nz
Mon Jul 29 21:31:22 CEST 2002

On Mon, Jul 29, 2002 at 03:50:02PM +0200, Stephan Holl wrote:
> The problem is the NA-Values. No-data-values are coded as -9999 in the
> table.
> But when I extrct them with any SELECT-statement, the -9999-values are
> treated as normal vectors.
> How can I tell R not to fetch the datasets containig -9999-values?

Two ways:
1) If you *do* want to see how many NA cases you have (this can
also be interesting sometimes), use R's usual indexing

...{get data with your select, store in a vector named foo} ...

foo[foo==-9999] <- NA

2) If you aren't interested in which cases were NA values, do
it from the SQL SELECT statement:

SELECT foo FROM bar WHERE foo <> -9999


Indigo Industrial Controls Ltd.
jasont at indigoindustrial.co.nz
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list