Subsetting in H2O R

别来无恙 提交于 2020-01-03 08:13:10

问题


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


回答1:


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,]


来源:https://stackoverflow.com/questions/27181616/subsetting-in-h2o-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!