Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subsetting in H2O R

Tags:

r

subset

h2o

I have a h2o object.

The standard R for subset

sub1<-trans[trans$Type==1,]

I tried the same in h2o. It is not working

sub1<-trans[trans$Type==1,]

I also tried

sub1<-h2o.exec(trans[trans$Type==1,])

note* trans is a h2o data Object.

Any idea to do it in h2o? Thanks

like image 359
chee.work.stuff Avatar asked Nov 28 '14 03:11

chee.work.stuff


1 Answers

I'm not sure if this is the most "hydrophilic" way to do this but:

transType <- trans$Type
sub1 <- trans[transType == 1,]

Seems to work for me with no problem.

For a more reproducible example, consider

library(h2o)
localH2O <- h2o.init()

prosPath <- system.file("extdata", "prostate.csv", package = "h2o")
prostate.hex <- h2o.importFile(localH2O, path = prosPath)
prostate.hex[prostate.hex$GLEASON == 6,]
like image 99
StevieP Avatar answered Oct 14 '22 21:10

StevieP