Subset in H2O R

I have an h2o object.

R standard for a subset

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

I tried the same in h2o. He does not work

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

I also tried

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

note * trans - h2o data object.

Any idea to do this in h2o? Thanks

+5
source share
1 answer

I'm not sure if this is the most β€œhydrophilic” way to do this, but:

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

I seem to be working without problems.

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,] 
+2
source

Source: https://habr.com/ru/post/1207861/


All Articles