null.data: A Data Set with lots of 'NA' values

null.dataR Documentation

A Data Set with lots of NA values

Description

An example data.frame which is used by examples in this user manual

Usage

data(null.data)

Format

This data has 104 columns and 2000 rows.

Details

This data set has lots of NA values in it. By using as.db.data.frame, one can put the data set into the connected database. All the NA values will be converted into NULL values.

Note

Lazy data loading is enabled in this package. So the user does not need to explicitly run data(null.data) to load the data. It will be loaded whenever it is used.

Examples

## Not run: 


## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)

## create a table from the example data.frame "abalone"
delete("null_data", conn.id = cid)
x <- as.db.data.frame(null.data, "null_data", conn.id = cid, verbose = FALSE)

## select columns
y <- x[,c("sf_mrtg_pct_assets","ris_asset", "lncrcd","lnauto",
          "lnconoth","lnconrp","intmsrfv","lnrenr1a","lnrenr2a",
          "lnrenr3a")]

dim(y)

## remove NULL values
for (i in 1:10) y <- y[!is.na(y[i]),]

dim(y)

db.disconnect(cid, verbose = FALSE)

## End(Not run)

greenplum-db/GreenplumR documentation built on Sept. 2, 2023, 8:09 a.m.