# LESSON 1: MOVEBANK require(move); require(lubridate) # Need to put in correct username and password below, in quotes login <- movebankLogin(username="xxxx", password="xxxx") caribou <- getMovebankData(study="ABoVE: ADFG Fortymile Caribou (for TWS workshop)", login=login) # If for some reason the line above doesn't work, run this line below: # load("./_data/caribou.raw.rda") # checking out the 'caribou' object head(caribou) slotNames(caribou) table(caribou@trackId) # Getting the bounding box of `caribou` and plotting it caribou@bbox plot(caribou) # converting `caribou` to a data frame caribou.df <- as.data.frame(caribou) str(caribou.df) # different (better) way of converting to a data frame caribou.df <- as(caribou, "data.frame") str(caribou.df) # loading a Google base map and plotting the data require(ggmap) basemap <- get_map(location = caribou@bbox, zoom = 8, maptype = "hybrid") ggmap(basemap) + geom_path(data = caribou.df, mapping = aes(x = location_long, y = location_lat, col = trackId), alpha=.7, size=1) + coord_map() + scale_colour_hue(l = 60) + labs(x = "Longitude", y = "Latitude") + ggtitle("Fortymile caribou paths in late summer 2017")