70 likes | 201 Views
R Skills Sharing: Aggregating Sensor Data and Importing to B3 . Jake Zwart GLEON FP – Sunapee, NH 2013-01-14. Overview of aggregate() and loadB3(). aggregate() splits data into subsets of data based on a list, applies a function to each subset, and returns results.
E N D
R Skills Sharing: Aggregating Sensor Data and Importing to B3 Jake Zwart GLEON FP – Sunapee, NH 2013-01-14
Overview of aggregate() and loadB3() • aggregate() splits data into subsets of data based on a list, applies a function to each subset, and returns results. • Importing to B3 function: writes .csv file that in correct format for B3 importing.
Relevance • Aggregate example: There is temperature data every 5 minutes, but you want daily average. Transform dateTime into date and use: aggregate(temp, by=list(date),FUN=mean) • Way more efficient than using for loops • loadB3() writes correctly formatted .csv file for B3, so you don’t have to mess around with excel
Application • Lake metabolism data unit conversion • Needed daily Zmix data to convert to areal units • loadB3() – lots of files to import into B3 from lake metabolism survey • Challenges • B3 is picky about formatting • User needs to know R date/time syntax
Results • BA_2012sonde B3input.csv