0

I'm using MonetDB and embedded R with a huge amount of accelerometer sensor data. I created an aggregate function which calculates a Fast Fourier Transformation on the sensor data and extracts a single value.

CREATE AGGREGATE fft_max_s(val double) RETURNS DOUBLE LANGUAGE R{
  sapply(split(val,aggr_group), FUN = function(d){
   max(Mod(fft(d)))
  })
};

My question: Is it possible to let this aggregate function create multiple values?

Frank
  • 98
  • 5
  • Yes you could use a table-to-table function. – Hannes Mühleisen Mar 22 '17 at 14:22
  • @HannesMühleisen Could you provide me some more information? Maybe a link to a documentation or something like that? – Frank Mar 22 '17 at 14:28
  • certainly, see for example http://dev.monetdb.org/hg/MonetDB/file/Dec2016/sql/backends/monet5/Tests/rapi16.sql – Hannes Mühleisen Mar 23 '17 at 09:48
  • @HannesMühleisen thank you for the link. It describes how to write a 'normal' function but not an aggregation function. The question remains, whether there is a way to write a way to write an aggregation function with multiple output columns, such as `min_max` which might output the minimum and the maximum of the group at the same time. – Frank Mar 24 '17 at 12:12

0 Answers0