dplyr basic functions not working in TERR data function

It seems that basic dplyr functions (e.g. filter) are not working in TERR.  I have tried using an both an input table and generating one natively and am getting the same error:

TERR version: 4.4.0

Spotfire version: Spotfire Analyst 7.12.0

dplyr version: dplyr (0.7.4)

#Error message
#TIBCO Enterprise Runtime for R returned an error: 'Error in function(x)
#{inherits(x, "spliced")}
#(Segment == "PERFE : object 'Segment' not found

 

#generate input table on the fly for testing
library(dplyr)
surveyOut <- data.frame(wellName = rep(LETTERS[1:10],each = 10),
Segment = rep(c("VERTICAL","PERFED"),times = 2))
surveyOut <- surveyOut %>% filter(Segment=='PERFED')

 

#read in table and apply filter
library(dplyr)
survey <- as.data.frame(surv)
#input table and dataframe both have column named Segment
surveyOut <- survey %>% filter(Segment=='PERFED')

When I run the code in the TERR console the output is filtered correctly.

> library(dplyr)
The following object(s) are masked _from_ 'package:stats':

    filter, lag
The following object(s) are masked _from_ 'base':

    intersect, setdiff, setequal, union
> #survey <- as.data.frame(surv)
> #vClass <- class(survey)
> #surveyOut <- survey %>% select(Segment)
> surveyOut <- data.frame(wellName = rep(LETTERS[1:10],each = 10),Segment = rep(c("VERTICAL","PERFED"),times = 2))
> surveyOut <- surveyOut %>% filter(Segment=='PERFED')
> head(surveyOut)
  wellName Segment
1        A  PERFED
2        A  PERFED
3        A  PERFED
4        A  PERFED
5        A  PERFED
6        B  PERFED

I realize that this can be worked around by setting columns in the data function, but have some more complex and flexible functions that would result in significant less friendly user manipulation and would like to avoid.

(1) Answer

Login