-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHOBO Data cleanup
60 lines (47 loc) · 1.79 KB
/
HOBO Data cleanup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## HOBO Data Clean Up Procedures
library(ggplot2)
library(dplyr)
library(tidyr)
library(gtools)
library(ggbiplot)
library(dismo)
library(rjson)
library(RCurl)
library(raster)
library(sp)
setwd("C:/Users/maxge/Downloads/Grad School Papers/Data-Analysis")
# Acquired HOBO Data collects readings every 30 minutes
## This means there's lots of data to comb through and make averages for
### So this will act as a way to create averages for each month
#### Before starting you will need to change the date and time columns into only month names for this to work
### Making averages for the day will specify into the just the date which can be a bit tedious to do by hand
MMA <- read.csv("Revised Data/MM Air Master.csv")
MMW <- read.csv("Revised Data/MM Water Master.csv")
TONA <- read.csv("Revised Data/TON Air Master.csv")
TONW <- read.csv("Revised Data/TON Water Master.csv")
UIA <- read.csv("Revised Data/UI Air Master.csv")
UIW <- read.csv("Revised Data/UI Water.csv")
Ultima <- list(MMA, MMW, TONA, TONW, UIA, UIW)
#This will tell us how many data points we have per month
# Now with the data point count we can begin averaging everything
avglist <- c()
files <- c("MMA", "MMW", "TONA", "TONW", "UIA", "UIW")
folder <- "Revised Data/"
#This will take all the data and average it then write individual files
## this can be changed to make it into a list or data frame if desired
## I prefer separate files for making figures down the line
for (i in 1:6){
flare <- Ultima[[i]]
months <- unique(flare$Date.Time..CST.)
for (i in 1:7){
month <- months[[i]]
data <- flare %>%
filter(Date.Time..CST. == month)
avg <- mean(data[, 3])
avglist[i] <- avg
fileA <- files[i]
fileB <- ".csv"
finalfile <- paste(folder, fileA, fileB, sep = "")
write.csv(cbind.data.frame(avglist), finalfile)
}
}