restructure data table based on date and other categorical variables
1 次查看(过去 30 天)
显示 更早的评论
I have a data table with 4 variables: d18O (water chemistry measurement), Site, Date and Depth
Site, Date and Depth are all categorical. d18O is the data.
I'm wondering if there is an efficient way to compare d18O collected from the same site, on the same date, at DIFFERENT depths. Some dates do not include d18O collected from multiple depths at the same site, but many do.
I'm completely at a loss of how to code this. I've been doing it manually in excel, but my actual dataset is much larger than what I've attached here and it's extremely inefficient.
Any ideas greatly appreciated.
0 个评论
采纳的回答
Voss
2023-10-24
T = readtable('data_test.csv')
T_summary = groupsummary(T,{'Site','Date'},@(x){x},{'d18O','Depth'});
T_summary = removevars(T_summary,'GroupCount');
T_summary = renamevars(T_summary,{'fun1_d18O','fun1_Depth'},{'d18O','Depth'})
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!