I am a research biologist who is relatively new at coding. I am working on cleaning up a dataset and automating a process to then be used in ArcGIS. I have a dataset from 2015 of about 10 birds that I am using as a sample year for right now. The end result I am looking for is a csv file for each bird, with a one to one join for each 15 minute GPS point to the spatial location I have. Where I run into issues is that the data loggers also have a dive logger for when the bird dives, but there is not specific GPS coordinates for dives.
Now I am a bit stuck. I need to combine the dive duration entries to the lat and long to the most taken GPS point to create a 1:1 join in ArcGIS (either the point above or below depending on timing). I would love to be able to create a code that results in the following (with potentially another column that has information for number of dives):
BIRD 1 TIME DATE LATITUDE LONGITUDE DIVE DURATION NUMBER OF DIVES
Is there a feature in dplyr
that can help with this?
Any help would be much appreciated!
EDIT: My current code:
# Start by connecting to 2015 data
data2015 <- read.csv("GPS data 2015\\GPS2015Birds.csv")
# select out individual logger.ID
i <- "GRE12"
# Now this starts to filter only the information wanted in the final CSV file
birdo <- data2015 %>%
filter(LoggerID== i)
birdie <- birdo %>%
filter(!is.na(Latitude)|Divingduration %in% c(4:120))
This is a sample of some of the data:
head(birdie)
LoggerID Year Month Day Hour Minute Second Latitude Longitude Divingduration
1 GRE12 2015 6 19 23 38 0 51.03007 -39.78358 NA
2 GRE12 2015 6 21 12 18 0 55.02958 -39.79267 NA
3 GRE12 2015 6 21 12 19 0 45.02962 -39.79262 NA
4 GRE12 2015 6 21 12 19 0 65.02960 -39.79275 NA
5 GRE12 2015 6 21 12 23 0 62.02960 -39.79272 NA
6 GRE12 2015 6 21 12 24 0 23.02960 -39.79257 NA
7 GRE12 2015 6 21 12 24 0 34.02955 -39.79247 NA
8 GRE12 2015 6 21 12 31 0 76.02958 -39.79275 NA
9 GRE12 2015 6 21 12 31 0 61.02960 -39.79267 NA
10 GRE12 2015 6 21 12 32 0 67.02958 -39.79270 NA
11 GRE12 2015 6 21 12 32 0 54.02960 -39.79277 NA
12 GRE12 2015 6 21 12 33 0 98.02963 -39.79272 NA
13 GRE12 2015 6 21 12 37 16 NA NA 24
14 GRE12 2015 6 21 12 48 0 12.03137 -39.79330 NA
15 GRE12 2015 6 21 13 3 0 41.03152 -39.79270 NA
16 GRE12 2015 6 21 13 18 0 98.03187 -39.79252 NA
17 GRE12 2015 6 21 13 33 0 43.03185 -39.79258 NA
18 GRE12 2015 6 21 13 49 0 59.03187 -39.79262 NA
19 GRE12 2015 6 21 14 4 0 38.03245 -39.79222 NA
20 GRE12 2015 6 21 14 19 0 93.03245 -39.79250 NA
21 GRE12 2015 6 21 14 35 0 69.03245 -39.79237 NA
22 GRE12 2015 6 21 14 50 0 32.04337 -39.80202 NA
23 GRE12 2015 6 21 15 5 0 54.05958 -39.88438 NA
24 GRE12 2015 6 21 15 20 0 76.05950 -39.88617 NA
25 GRE12 2015 6 21 15 35 0 23.05945 -39.88620 NA
26 GRE12 2015 6 21 15 51 0 43.05943 -39.88617 NA
27 GRE12 2015 6 21 16 3 16 NA NA 4
28 GRE12 2015 6 21 16 6 0 99.05950 -39.88662 NA
29 GRE12 2015 6 21 16 21 0 63.05517 -39.89503 NA
30 GRE12 2015 6 21 16 33 46 NA NA 4
31 GRE12 2015 6 21 16 34 48 NA NA 6
32 GRE12 2015 6 21 16 37 0 78.04935 -39.90928 NA
33 GRE12 2015 6 21 16 37 42 NA NA 7