[datatable-help] aggregate data.table by group by reference
Matthew Forrest
matthew.forrest at senckenberg.de
Wed Mar 7 11:04:25 CET 2018
Hi all,
A real data.table question here ;-)
I am currently doing this:
output.dt <- input.dt[,lapply(.SD, method.function), by=by.dims]
where method.function is an arbitrary function and by.dims is a list of
columns (although perhaps I could remove this is the data.table was
keyed by those columns?)
That doesn't look very data.table-y to me, potentially it would be great
to do it with := in the proper data.table way. Is that possible? I
have tried a couple of things but haven't managed. The problem is that I
need to be flexible to deal with arbitrary columns in my data.table.
Any suggestions?
Many thanks,
Matt
--
Dr Matthew Forrest
Senckenberg Biodiversity and Climate Research Centre (BiK-F)
Visiting address: Georg-Voigt-Straße 14-16, room 3.04, Frankfurt am Main
Postal address: Senckenberganlage 25
D-60325 Frankfurt am Main
Tel.: +49-69-7542-1867
Fax: +49-69-7542-7904
E-mail: matthew.forrest at senckenberg.de
Homepage: www.bik-f.de
Senckenberg Gesellschaft für Naturforschung
Rechtsfähiger Verein gemäß § 22 BGB
Senckenberganlage 25
60325 Frankfurt
Direktorium: Prof. Dr. Dr. h.c. Volker Mosbrugger, Prof. Dr. Andreas Mulch, Stephanie Schwedhelm, Prof. Dr. Katrin Böhning-Gaese, Prof. Dr. Uwe Fritz, PD Dr. Ingrid Kröncke
Präsidentin: Dr. h.c. Beate Heraeus
Aufsichtsbehörde: Magistrat der Stadt Frankfurt am Main (Ordnungsamt)
More information about the datatable-help
mailing list