Summarizing timetable data when categorical variables are present

3 visualizaciones (últimos 30 días)
Cameron McIntire
Cameron McIntire el 30 de Nov. de 2018
Comentada: Christopher Lawson el 10 de Sept. de 2020
I have a table with repeating timestamped ('long-form') data and categorical variables that are assigned to each measurement (in this case temperature and humidity). What I want to do is summarize daily means while nesting within the categorical variables. Is this possible to do using the retime function?
'06/01/2015 00:00' 9.16300000000000 100 'Control' 'C1' 'S1' 'Open' 'Treatment' 'Year 0'
'06/01/2015 00:15' 9.21300000000000 100 'Control' 'C1' 'S1' 'Open' 'Treatment' 'Year 0'
'06/01/2015 00:30' 9.21300000000000 100 'Control' 'C1' 'S1' 'Open' 'Treatment' 'Year 0'
'06/01/2015 00:45' 9.16300000000000 100 'Control' 'C1' 'S1' 'Open' 'Treatment' 'Year 0'
'06/01/2015 01:00' 9.06400000000000 100 'Control' 'C1' 'S1' 'Open' 'Treatment' 'Year 0'
'06/01/2015 01:15' 8.81700000000000 100 'Control' 'C1' 'S1' 'Open' 'Treatment' 'Year 0'
'06/01/2015 01:30' 8.71700000000000 100 'Control' 'C1' 'S1' 'Open' 'Treatment' 'Year 0'

Respuestas (2)

Walter Roberson
Walter Roberson el 1 de Dic. de 2018

Peter Perkins
Peter Perkins el 11 de Dic. de 2018
Cameron, the answer is not really. retime is all about time.
I thik what you want is something like varfun using time and some other variable(s) as GroupingVariables, or as Walter suggests, findgroups and splitapply.
Also, it looks like you have categorical data, but stored as text variables. You might be happier if you explicitly converted those text vars to be categoricals.
  4 comentarios
Walter Roberson
Walter Roberson el 5 de Sept. de 2020
When you use splitapply() with a table() object, the function is passed one parameter for each table variable.
Perhaps
splitapply(@(varargin)retimeMonthly(cell2table(varargin, 'VariableNames', TT.Properties.VariableNames), TT, groups)
Christopher Lawson
Christopher Lawson el 10 de Sept. de 2020
Thanks, I had success with this
splitapply(@(varargin)retimeMonthly(table(varargin{1,:}, 'VariableNames', t.Properties.VariableNames)), t, groups)
(but I also had to "re-timeable" the function argument inside the retimeMontly.
THANK YOU!

Iniciar sesión para comentar.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by