restructure data table based on date and other categorical variables
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Voss
le 24 Oct 2023
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!