Error with dplyr, group_by, predict, loess in TERR

I'm using dplyr to smooth the column WATER in my data.frame SelectedDAILY

  • group_by PROPNUM
  • mutate
  • predict / loess

This line of code works perfectly in R Studio, however it doesn't work in TERR Console or in the Spotfire Data Function:

SelectedDAILY <- SelectedDAILY %>% group_by(PROPNUM) %>% mutate(WATER = predict(loess(WATER ~as.numeric(D_DATE),na.action=na.exclude,span = 0.05)))

Basically I get this error, either in the TERR console or from the Spotfire data function evaluation: Error: object "WATER" not found.

TIBCO Enterprise Runtime for R returned an error: 'Error: object "WATER" not found'.
   at Spotfire.Dxp.Data.DataFunctions.Executors.LocalFunctionClient.OnExecuting()
   at Spotfire.Dxp.Data.DataFunctions.Executors.AbstractFunctionClient.<RunFunction>d__0.MoveNext()
   at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
   at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()

RStudio: using R version 3.4.3,  dplyr_0.7.4, from my TERR console session info, I've got: R version 4.3.0, "dplyr_0.5.0"  "magrittr_1.5"

I've tried to update the packages in TERR, and even uninstalled and reinstalled them, but the versions are not changing.

Any idea why the WATER column is not being identified as part of the data frame from the pipe?

Thanks

(2) Answers

Login