Spotfire でデータ関数を使用しています。sqldf パッケージをインストールしました。クエリは次のとおりです。
#Package to run sqls
library(sqldf)
#Input data frame
op1 <- sqldf("SELECT Prod_parnt,prodct_grop,year,month,week,
count(distinct id) as prd_cnt,
Sum(Count(distinct id))
over (partition by modlty,prodct_grop order by year,month,week
rows between 12 preceding and current row) as cumu_prd_cnt,
avg(rate) as sal_rate
FROM ip1
group by Prod_parnt,prodct_grop,year,month,week")
私が直面しているエラー:
「TIBCO Spotfire Statistics Services がエラーを返しました: 'エラー: ステートメントのエラー: 近くに "(": 構文エラー'."
ここで注意すべき点は、ウィンドウ関数ステートメント、つまり cumu_prd_cnt フィールドを削除したときです。コードは正常に動作します。
君の力が必要。