0

I am new to Microsoft Revr. I am facing a small problem in the below code

FILTER<-"TRANS > 0"                                                  
max_rows_cols <- 100000000000000000000 

data1 <- rxDataStep(inData = data1,transformObjects=list(Filter=FILTER),
rowSelection =**noquote(Filter)** ,overwrite = TRUE,maxRowsByCols=max_rows_cols)

I get the value of FILTER at run time.

Is Something wrong with the row selection value?

Looking forward to help on this?

4

2 回答 2

2

rowSelection参数应该是一个表达式,给出要保留的行。您需要解析(但不评估)您的过滤器文本:

filterExpr <- parse(text=FILTER)
df <- rxDataStep(data1, rowSelection=filterExpr, maxRowsByCols=NULL)

请注意,如果要关闭数据集大小检查,请设置maxRowsByCols=NULL.

于 2017-01-06T09:06:41.707 回答
0

我们可以用eval(parse

library(RevoScaleR)
rxDataStep(inData = data1, transformObjects=list(Filter=FILTER),
                  rowSelection = eval(parse(text=Filter)))
#  Rows Read: 5, Total Rows Processed: 5, Total Chunk Time: 0.003 seconds 
#  Col1 TRANS
#1    3     1
#2    4     3
#3    5     2

数据

data1 <- data.frame(Col1 = 1:5, TRANS = c(-5, -4, 1, 3, 2))
FILTER<-"TRANS > 0"     
于 2017-01-06T08:59:05.400 回答