【问题标题】:Subset category in ML Server using rxDataStep使用 rxDataStep 的 ML Server 中的子集类别
【发布时间】:2018-03-22 03:45:31
【问题描述】:

如何使用 ML 服务器中的 rxDataStep 过滤客户 A?现在我只设法找到连续变量选择示例。

latency <- rxDataStep(inData = data, varsToKeep = c("ex_customer","timestamp","total"), rowSelection =  )

> df = data.frame(customer=c(rep("A",3),rep("B",4)), tansaction = c(1,2,3,4,5,6,7) )
> df
  customer tansaction
1        A          1
2        A          2
3        A          3
4        B          4
5        B          5
6        B          6
7        B          7

【问题讨论】:

  • 我设法解决了,谢谢。

标签: r microsoft-r


【解决方案1】:

rxDataSteprowSelection 参数采用任何有效的 R 表达式:

rxDataStep(df, rowselection=customer == "A"))

为了更轻松地处理这些数据,您还可以使用我的 dplyrXdf 包,它实现了 Xdf 文件的 dplyr 接口。

library(dplyrXdf)
xdf <- as_xdf(df, "file.xdf")
out <- xdf %>% filter(customer == "A")
head(out)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-23
    • 1970-01-01
    • 2021-06-04
    • 2021-05-31
    • 1970-01-01
    • 2021-09-10
    • 1970-01-01
    相关资源
    最近更新 更多