ropensci / pangaear

R client for the Pangaea database
https://docs.ropensci.org/pangaear
Other
21 stars 10 forks source link

Parse variables into tibble #81

Open lukasjonkers opened 2 years ago

lukasjonkers commented 2 years ago

Description

Amended the read_meta function in an attempt to better parse the parameter description. Rather than a list of lists the parameters element in metadata now contains a more structured tibble with name, short name, unit, PI, method and comment like on the pangaea website. This should allow searching the metadata and facilitate using the metadata in a hopefully more meaningful way.

Related Issue

None. Just a personal wish that I thought others might find useful too.

Example

Based on https://doi.pangaea.de/10.1594/PANGAEA.115823 Old

[[1]]
[1] "DEPTH, water [m] (Depth water)" "GEOCODE"                       

[[2]]
[1] "DATE/TIME (Date/Time)" "GEOCODE"              

[[3]]
[1] "Date/time end (Date/time end)"                                                                                                           
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"

[[4]]
[1] "Duration, number of days [days] (Duration)"                                                                                              
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated"                                                                                                               

[[5]]
[1] "Sample code/label (Sample label)"                                                                                                        
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"

[[6]]
[1] "Total mass, flux per day [mg/m"                                                                                                          
[2] ""                                                                                                                                        
[3] "2/day] (Mass flux)"                                                                                                                      
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[7]]
[1] "Calcium carbonate, flux [mg/m"                                                                                                           
[2] ""                                                                                                                                        
[3] "2/day] (CaCO3 flux)"                                                                                                                     
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Element analyser CHN, Heraeus"                                                                                            

[[8]]
[1] "Lithogenic, flux [mg/m"                                                                                                                  
[2] ""                                                                                                                                        
[3] "2/day] (Litho flux)"                                                                                                                     
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[9]]
[1] "Opal, flux [mg/m"                                                                                                                        
[2] ""                                                                                                                                        
[3] "2/day] (bSiO2 flux)"                                                                                                                     
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Opal, auto analysis (Müller & Schneider, 1993) (URI: https://doi.org/10.1016/0967-0637(93)90140-X)"                       

[[10]]
[1] "Carbon, organic, particulate, flux [mg/m"                                                                                                
[2] ""                                                                                                                                        
[3] "2/day] (POC flux)"                                                                                                                       
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Element analyser CHN, Heraeus"                                                                                            

[[11]]
[1] "Calcium carbonate, flux of total flux [%] (CaCO3 flux)"                                                                                  
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[12]]
[1] "Lithogenic, flux of total flux [%] (Litho flux)"                                                                                         
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[13]]
[1] "Opal, flux of total flux [%] (bSiO2 flux)"                                                                                               
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[14]]
[1] "Carbon, organic, particulate, flux of total flux [%] (POC flux)"                                                                         
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[15]]
[1] "δ15N, gas [‰ air] (δ15N-N2)"                                                                                                             
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Mass spectrometer Finnigan Delta Plus"                                                                                    

[[16]]
[1] "Coccolith, fluxes [10"                                                                                                                   
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (Coccolith fluxes)"                                                                                                               
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[17]]
[1] "Emiliania huxleyi, flux [10"                                                                                                             
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (E. huxleyi flux)"                                                                                                                
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccolithen"                                                                                                                    

[[18]]
[1] "Emiliania huxleyi, flux [10"                                                                                                             
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (E. huxleyi flux)"                                                                                                                
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccospheres"                                                                                                                   

[[19]]
[1] "Elphidium advenum [%] (E. advenum)"                                                                                                      
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccolithen"                                                                                                                    

[[20]]
[1] "Calcidiscus leptoporus, flux [10"                                                                                                        
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (C. leptoporus flux)"                                                                                                             
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccolithen"                                                                                                                    

[[21]]
[1] "Calcidiscus leptoporus, flux [10"                                                                                                        
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (C. leptoporus flux)"                                                                                                             
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccospheres"                                                                                                                   

[[22]]
[1] "Calcidiscus leptoporus [%] (C. leptoporus)"                                                                                              
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccolithen"                                                                                                                    

[[23]]
[1] "Calcidiscus leptoporus [%] (C. leptoporus)"                                                                                              
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccospheres"                                                                                                                   

[[24]]
[1] "Syracosphaera lamina, flux [10"                                                                                                          
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (S. lamina flux)"                                                                                                                 
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccolithen"                                                                                                                    

[[25]]
[1] "Syracosphaera lamina, flux [10"                                                                                                          
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (S. lamina flux)"                                                                                                                 
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccospheres"                                                                                                                   

[[26]]
[1] "Syracosphaera lamina [%] (S. lamina)"                                                                                                    
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccolithen"                                                                                                                    

[[27]]
[1] "Syracosphaera lamina [%] (S. lamina)"                                                                                                    
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccospheres"                                                                                                                   

[[28]]
[1] "Gladiolithus flabellatus, flux [10"                                                                                                      
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (G. flabellatus flux)"                                                                                                            
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccolithen"                                                                                                                    

[[29]]
[1] "Gladiolithus flabellatus [%] (G. flabellatus)"                                                                                           
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccolithen"                                                                                                                    

[[30]]
[1] "Coccospheres, flux [10"                                                                                                                  
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (Coccosp flux)"                                                                                                                   
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccolithen"                                                                                                                    

[[31]]
[1] "Emiliania huxleyi [%] (E. huxleyi)"                                                                                                      
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccospheres"                                                                                                                   

[[32]]
[1] "Oolithotus fragilis [%] (O. fragilis)"                                                                                                   
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Coccospheres"                                                                                                                   

[[33]]
[1] "Oolithotus fragilis, flux [10"                                                                                                           
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (O. fragilis flux)"                                                                                                               
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: Coccospheres"                                                                                                                   

[[34]]
[1] "Foraminifera, planktic, flux [#/m"                                                                                                       
[2] ""                                                                                                                                        
[3] "2/day] (Foram plankt flux)"                                                                                                              
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[6] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[35]]
[1] "Globorotalia inflata [%] (G. inflata)"                                                                                                   
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[36]]
[1] "Globorotalia inflata, flux [#/m"                                                                                                         
[2] ""                                                                                                                                        
[3] "2/day] (G. inflata flux)"                                                                                                                
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[6] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[37]]
[1] "Neogloboquadrina pachyderma dextral [%] (N. pachyderma d)"                                                                               
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[38]]
[1] "Neogloboquadrina pachyderma dextral, flux [#/m"                                                                                          
[2] ""                                                                                                                                        
[3] "2/day] (N. pachyderma d flux)"                                                                                                           
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[6] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[39]]
[1] "Globigerina bulloides [%] (G. bulloides)"                                                                                                
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[40]]
[1] "Globigerina bulloides, flux [#/m"                                                                                                        
[2] ""                                                                                                                                        
[3] "2/day] (G. bulloides flux)"                                                                                                              
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[6] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[41]]
[1] "Orbulina universa [%] (O. universa)"                                                                                                     
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[42]]
[1] "Orbulina universa, flux [#/m"                                                                                                            
[2] ""                                                                                                                                        
[3] "2/day] (O. universa flux)"                                                                                                               
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[6] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[43]]
[1] "Globigerinoides ruber white [%] (G. ruber w)"                                                                                            
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[4] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[44]]
[1] "Globigerinoides ruber white, flux [#/m"                                                                                                  
[2] ""                                                                                                                                        
[3] "2/day] (G. ruber w flux)"                                                                                                                
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[6] "COMMENT: Foraminifera (>150 µm)"                                                                                                         

[[45]]
[1] "Diatom valve, flux [#/m"                                                                                                                 
[2] ""                                                                                                                                        
[3] "2/day] (Diatom valv flux)"                                                                                                               
[4] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[5] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[46]]
[1] "Fragilariopsis doliolus [%] (F. doliolus)"                                                                                               
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[47]]
[1] "Fragilariopsis doliolus, flux [10"                                                                                                       
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (F. doliolus flux)"                                                                                                               
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[48]]
[1] "Actinocyclus curvatulus [%] (A. curvatulus)"                                                                                             
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[49]]
[1] "Actinocyclus curvatulus, flux [10"                                                                                                       
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (A. curvatulus flux)"                                                                                                             
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[50]]
[1] "Azpeitia spp. [%] (Azpeitia spp.)"                                                                                                       
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[51]]
[1] "Azpeitia spp., flux [10"                                                                                                                 
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (Azpeitia spp. flux)"                                                                                                             
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[52]]
[1] "Coscinodiscus radiatus [%] (C. radiatus)"                                                                                                
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[53]]
[1] "Coscinodiscus radiatus, flux [10"                                                                                                        
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (C. radiatus flux)"                                                                                                               
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[54]]
[1] "Actinocyclus octonarius [%] (A. octonarius)"                                                                                             
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[55]]
[1] "Actinocyclus octonarius, flux [10"                                                                                                       
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (A. octonarius flux)"                                                                                                             
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[56]]
[1] "Thalassionema nitzschioides var. inflata [%] (T. nitzschioides var. inflata)"                                                            
[2] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[3] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             

[[57]]
[1] "Thalassionema nitzschioides, flux [10"                                                                                                   
[2] ""                                                                                                                                        
[3] "6 #/m"                                                                                                                                   
[4] ""                                                                                                                                        
[5] "2/day] (T. nitzschioides flux)"                                                                                                          
[6] "PI: Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@uni-bremen.de, https://www.researchgate.net/profile/Oscar-Romero-21)"
[7] "METHOD/DEVICE: Calculated, see reference(s)"                                                                                             
[8] "COMMENT: T. nitzschioides var. inflata"  

New

# A tibble: 57 × 6
   longName                                         shortName                     Unit             PI                                                                Metho…¹ Comment
   <chr>                                            <chr>                         <chr>            <chr>                                                             <chr>   <chr>  
 1 DEPTH, water                                     Depth water                   m                NA                                                                NA      NA     
 2 DATE/TIME                                        Date/Time                     NA               NA                                                                NA      NA     
 3 Date/time end                                    Date/time end                 NA               Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… NA      NA     
 4 Duration, number of days                         Duration                      days             Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
 5 Sample code/label                                Sample label                  NA               Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… NA      NA     
 6 Total mass, flux per day                         Mass flux                     mg/m**2/day      Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
 7 Calcium carbonate, flux                          CaCO3 flux                    mg/m**2/day      Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Elemen… NA     
 8 Lithogenic, flux                                 Litho flux                    mg/m**2/day      Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
 9 Opal, flux                                       bSiO2 flux                    mg/m**2/day      Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Opal, … NA     
10 Carbon, organic, particulate, flux               POC flux                      mg/m**2/day      Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Elemen… NA     
11 Calcium carbonate, flux of total flux            CaCO3 flux                    %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
12 Lithogenic, flux of total flux                   Litho flux                    %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
13 Opal, flux of total flux                         bSiO2 flux                    %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
14 Carbon, organic, particulate, flux of total flux POC flux                      %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
15 δ15N, gas                                        δ15N-N2                       ‰ air            Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Mass s… NA     
16 Coccolith, fluxes                                Coccolith fluxes              10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
17 Emiliania huxleyi, flux                          E. huxleyi flux               10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
18 Emiliania huxleyi, flux                          E. huxleyi flux               10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
19 Elphidium advenum                                E. advenum                    %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
20 Calcidiscus leptoporus, flux                     C. leptoporus flux            10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
21 Calcidiscus leptoporus, flux                     C. leptoporus flux            10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
22 Calcidiscus leptoporus                           C. leptoporus                 %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
23 Calcidiscus leptoporus                           C. leptoporus                 %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
24 Syracosphaera lamina, flux                       S. lamina flux                10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
25 Syracosphaera lamina, flux                       S. lamina flux                10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
26 Syracosphaera lamina                             S. lamina                     %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
27 Syracosphaera lamina                             S. lamina                     %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
28 Gladiolithus flabellatus, flux                   G. flabellatus flux           10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
29 Gladiolithus flabellatus                         G. flabellatus                %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
30 Coccospheres, flux                               Coccosp flux                  10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccol…
31 Emiliania huxleyi                                E. huxleyi                    %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
32 Oolithotus fragilis                              O. fragilis                   %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
33 Oolithotus fragilis, flux                        O. fragilis flux              10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Coccos…
34 Foraminifera, planktic, flux                     Foram plankt flux             #/m**2/day       Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
35 Globorotalia inflata                             G. inflata                    %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
36 Globorotalia inflata, flux                       G. inflata flux               #/m**2/day       Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
37 Neogloboquadrina pachyderma dextral              N. pachyderma d               %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
38 Neogloboquadrina pachyderma dextral, flux        N. pachyderma d flux          #/m**2/day       Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
39 Globigerina bulloides                            G. bulloides                  %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
40 Globigerina bulloides, flux                      G. bulloides flux             #/m**2/day       Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
41 Orbulina universa                                O. universa                   %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
42 Orbulina universa, flux                          O. universa flux              #/m**2/day       Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
43 Globigerinoides ruber white                      G. ruber w                    %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
44 Globigerinoides ruber white, flux                G. ruber w flux               #/m**2/day       Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… Forami…
45 Diatom valve, flux                               Diatom valv flux              #/m**2/day       Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
46 Fragilariopsis doliolus                          F. doliolus                   %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
47 Fragilariopsis doliolus, flux                    F. doliolus flux              10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
48 Actinocyclus curvatulus                          A. curvatulus                 %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
49 Actinocyclus curvatulus, flux                    A. curvatulus flux            10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
50 Azpeitia spp.                                    Azpeitia spp.                 %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
51 Azpeitia spp., flux                              Azpeitia spp. flux            10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
52 Coscinodiscus radiatus                           C. radiatus                   %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
53 Coscinodiscus radiatus, flux                     C. radiatus flux              10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
54 Actinocyclus octonarius                          A. octonarius                 %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
55 Actinocyclus octonarius, flux                    A. octonarius flux            10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
56 Thalassionema nitzschioides var. inflata         T. nitzschioides var. inflata %                Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… NA     
57 Thalassionema nitzschioides, flux                T. nitzschioides flux         10**6 #/m**2/day Romero, Oscar E (https://orcid.org/0000-0003-0209-3258, oromero@… Calcul… T. nit…
# … with abbreviated variable name ¹​Method_Device

Test

I ran this with for 10s of DOIs and think it works. No guarantee though, I'm no regexp expert.

gavinsimpson commented 2 years ago

Thanks for the suggestion @lukasjonkers

Looks like the changes are failing the testthat tests. I'll look in more detail later, but perhaps it would be better to keep the function returning what it currently does but provide an as_tibble() method for objects returned by read_meta() (after imposing a class on those objects in read_meta())?

That way your workflow would be

read_meta() |>
  as_tibble()

leaving the original function most untouched?

lukasjonkers commented 2 years ago

Hi @gavinsimpson I saw too that the tests are failing. Perhaps this is because the structure of the output changes with my suggestion?

Your suggestion to simply convert the output of the original function to a tibble does not address the issue that the metadata text is inadequately parsed in the first place. The only thing the function does now is split at , but 1) that means that there are unnecessary splits because also occurs in units (see example above and my suggestion to catch this problem) and 2) that the name, short name and unit are not parsed at all. I would find it useful in order to better filter the data.

gavinsimpson commented 2 years ago

@lukasjonkers Sorry that I wasn't clear. Let's assume we fix the meta data parsing problems (which seems like something we certainly should do), would an as_tibble() method work in that case such that we don't change the structure of the returned object and potentially break existing code?

lukasjonkers commented 2 years ago

Hi @gavinsimpson I understand your concern not to break existing code, although I am not sure how many people have written code to parse the metadata list that is currently returned.

Nevertheless, in that case it would make sense to return a more structured list (with the same elements as columns in the tibble?), rather than a tibble as in my suggestion. I'm not sure how as_tibble would solve this, but maybe I'm overlooking things.

The testthat tests fail exactly because I suggested changing the output from a list to a tibble, but I guess you saw that already. Below is copied from test-pg_data.R

 # parameters has extra parsing
  ## its a list
  expect_is(aa[[1]]$metadata$parameters, "list")
  ## not named
  expect_named(aa[[1]]$metadata$parameters, NULL)
  ## length of the list of parameters should equal columns of data
  expect_equal(length(aa[[1]]$metadata$parameters), NCOL(aa[[1]]$data))