Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PUBDEV-1188: add mergecat test as proper runit
- Loading branch information
1 parent
a36c14f
commit 3ef148b
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f"))) | ||
source('../h2o-runit.R') | ||
|
||
test.mergecat <- function(conn) { | ||
census_path <- locate("smalldata/chicago/chicagoCensus.csv") | ||
crimes_path <- locate("smalldata/chicago/chicagoCrimes10k.csv.zip") | ||
|
||
Log.info("Import Chicago census data...") | ||
census_raw <- h2o.importFile(census_path, parse=FALSE) | ||
census_setup <- h2o.parseSetup(census_raw) | ||
census_setup$column_types[2] <- "Enum" # change from String -> Enum | ||
census <- h2o.parseRaw(census_raw, col.types=census_setup$column_types) | ||
|
||
Log.info("Import Chicago crimes data...") | ||
crimes <- h2o.importFile(crimes_path) | ||
|
||
Log.info("Set column names to be syntactically valid for R") | ||
names(census) <- make.names(names(census)) | ||
names(crimes) <- make.names(names(crimes)) | ||
print(summary(census)) | ||
print(summary(crimes)) | ||
|
||
Log.info("Merge crimes and census data on community area number") | ||
names(census)[names(census) == "Community.Area.Number"] <- "Community.Area" | ||
crimeMerge <- h2o.merge(crimes, census) | ||
print(summary(crimeMerge)) | ||
|
||
testEnd() | ||
} | ||
|
||
doTest("Merging H2O Frames that contain categorical columns", test.mergecat) |