8

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

chee.work.stuff
  • 326
  • 2
  • 14
  • Is it from the h2o package? – akrun Nov 28 '14 at 03:50
  • yes. it is from h2o package. – chee.work.stuff Nov 28 '14 at 03:59
  • Please take the time to create a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Give the code you are using to create your object (or a similar one). This will make it easier to help you. Also, including all the necessary `library()` statements in your example would help show where functions are coming from. – MrFlick Nov 28 '14 at 04:39
  • Ideally, your first command should work. Could you please add the result of the following command: h2o.table(trans$Type) – Ravi Nov 28 '14 at 06:25
  • It does works but I am doing it for about 100k rows, and it is slow. Any way to improve the performance? – chee.work.stuff Nov 28 '14 at 06:37
  • Found a way myself, `sub1<-trans[trans$type==1,names(trans)]` – chee.work.stuff Dec 01 '14 at 09:02

1 Answers1

5

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,]
StevieP
  • 1,569
  • 12
  • 23