Received: 10 April 2017 | Revised: 15 June 2017 | Accepted: 16 June 2017 DOI: 10.1002/ece3.3240 ORIGINAL RESEARCH feedr and animalnexus.ca: A paired R package and user-­friendly Web application for transforming and visualizing animal movement data from static stations Stefanie E. LaZerte1,2 | Matthew W. Reudink3 | Ken A. Otter2 | Jackson Kusack3 | Jacob M. Bailey2 | Austin Woolverton4 | Mark Paetkau4 | Adriaan de Jong5 | David J. Hill1 1 Department of Geography and Environmental Studies, Thompson Rivers University, Kamloops, BC, Canada 2 Abstract Radio frequency identification (RFID) provides a simple and inexpensive approach for Natural Resources and Environmental Studies, University of Northern British Columbia, Prince George, BC, Canada examining the movements of tagged animals, which can provide information on spe- 3 addition, tracking animal movements is appealing to naturalists, citizen scientists, and Department of Biological Sciences, Thompson Rivers University, Kamloops, BC, Canada 4 Department of Physics, Thompson Rivers University, Kamloops, BC, Canada 5 Department of Wildlife, Fish, and Environmental Studies, Swedish University of Agricultural Sciences, Umeå, Sweden Correspondence Stefanie E. LaZerte, Department of Geography and Environmental Studies, Thompson Rivers University, Kamloops, BC, Canada. Email: slazerte@tru.ca Funding information Natural Sciences and Engineering Research Council of Canada; Thompson Rivers University cies behavior and ecology, such as habitat/resource use and social interactions. In the general public and thus represents a tool for public engagement in science and science education. Although a useful tool, the large amount of data collected using RFID may quickly become overwhelming. Here, we present an R package (feedr) we have developed for loading, transforming, and visualizing time-­stamped, georeferenced data, such as RFID data collected from static logger stations. Using our package, data can be transformed from raw RFID data to visits, presence (regular detections by a logger over time), movements between loggers, displacements, and activity patterns. In addition, we provide several conversion functions to allow users to format data for use in functions from other complementary R packages. Data can also be visualized through static or interactive maps or as animations over time. To increase accessibility, data can be transformed and visualized either through R directly, or through the companion site: http://animalnexus.ca, an online, user-­friendly, R-­based Shiny Web application. This system can be used by professional and citizen scientists alike to view and study animal movements. We have designed this package to be flexible and to be able to handle data collected from other stationary sources (e.g., hair traps, static very high frequency (VHF) telemetry loggers, observations of marked individuals in colonies or staging sites), and we hope this framework will become a meeting point for science, education, and community awareness of the movements of animals. We aim to inspire citizen engagement while simultaneously enabling robust scientific analysis. KEYWORDS feedr, movement, open-source, R, radio frequency identification, Shiny, user-friendly, visualization, Web application This is an open access article under the terms of the Creative Commons Attribution License, which permits use, distribution and reproduction in any medium, provided the original work is properly cited. © 2017 The Authors. Ecology and Evolution published by John Wiley & Sons Ltd. 7884 | www.ecolevol.org  Ecology and Evolution. 2017;7:7884–7896. LAZERTE et al. | 7885 F I G U R E 1 The feedr package can be used in three different (but not mutually exclusive) ways. First, there are the basic package functions to be used in R. These give the user the most control over the data and the output. Second, there are standalone Shiny apps which launch user interfaces from R. This allows users familiar with R to use a combo of the basic R functions and easy-­to-­use interfaces. Finally, by accessing the online Web app at animalnexus.ca, users can load, transform, and visualize data without using R directly. Usage is indicated by functions()or by site location. Arrows indicate work flow order 1 | INTRODUCTION Hebert, Napolillo, & Allen, 2013; interspecific social interactions Farine et al., 2015; foraging patterns Bonter, Zuckerberg, Sedgwick, Radio frequency identification (RFID) can provide a simple, inex- & Hochachka, 2013; pathogen transmission Adelman, Moyers, Farine, pensive solution for examining the behavior and movements of an- & Hawley, 2015). RFID loggers also have the potential to work well imals (Bonter & Bridge, 2011). Bridge and Bonter (2011) are largely in citizen science projects, as many people enjoy helping to main- responsible for popularizing this technique by developing and shar- tain habitat such as nest boxes or feeders, and may be interested in ing plans for a low-­cost RFID logger that could be made simply and understanding the movements of birds or other animals throughout easily (http://www.animalmigration.org/RFID/CheapRFID.htm). the urban landscape. Citizen science is a powerful tool for investigat- Fitting animals with inexpensive, lightweight PIT tags and placing ing urban ecosystems and informing conservation efforts (Cooper, RFID loggers on or near feeders or nests results in a simple tech- Dickinson, Phillips, & Bonney, 2007). For citizen science projects nique for logging large numbers of visits to a particular location. to succeed, however, participation must be maintained through ef- Further, due to the low cost of PIT tags, they can be deployed on fective communication with, and regular feedback to, participants a large number of individuals, quickly resulting in large amounts of (Dickinson et al., 2012). Therefore, any RFID-­based citizen science data that, while useful, may be overwhelming for many researchers. project would benefit from being able to quickly and easily summa- Despite these data challenges, RFID technology has been quickly rize and provide clear and interesting visualizations of RFID data. adopted by researchers studying a variety of animal behaviors (e.g., RFID systems are therefore powerful in that they can collect parental care Bartsch, Weiss, & Kipper, 2015; fledging Johnson, large amounts of data, but difficult in that the amount of data may 7886 | FIGURE 2 LAZERTE et al. User interface for importing data. Accessible through the “Import” tab at animalnexus.ca or by calling the function ui_import() be overwhelming for many scientists and projects. Further, RFID data By combining traditional R functions with Shiny Web apps, we require substantial postprocessing and can be challenging to interpret. have developed a free and open-­source tool for addressing the chal- The technical and computer skills required to process the data also lenges associated with managing RFID (and similar) data. This tool is create problems of accessibility, making it difficult for nonspecialists simultaneously powerful, flexible, and customizable while also being or students to access and interpret the data. user-­friendly. The R package, feedr, provides the basic tools and Free and open-­source software (FOSS) is ideal for providing researchers with tools to deal with large amounts of data. The “free” aspect reduces financial barriers to its use, and the “open-­source” aspect permits and encourages collaboration which can result in better, functions, while the online Shiny Web app (http://animalnexus.ca) per- mits users to apply feedr functions to their RFID data through a user-­ friendly interface without having to install R or the feedr package. Further, we provide several conversion functions which help users for- more powerful software. The statistical software environment, R (R mat RFID data for use by other R packages. While our package was ini- Development Core Team, 2008), is FOSS and allows users to develop tially developed for visualizing movements of small birds carrying PIT powerful packages to extend its use. In fact, there are already sev- tags between RFID loggers mounted on feeders, we have developed eral R packages which provide valuable tools for analysis of raw or feedr with flexibility in mind; it can be used for any data set in which transformed RFID data (e.g., social network analysis in asnipe Farine, uniquely identified individuals have time-­stamped visits recorded at 2017; dominance interactions aniDom Farine & Sanchez-­Tojar, 2017; georeferenced locations. These may include data collected from hair ever, there are few if any packages that focus on broad data transfor- servations of marked individuals in colonies or staging sites. Dominance Fujii et al., 2016; Perc Krueger & Krueger, 2016); howmations/summarizations and visualizations of RFID data. traps, static very high frequency (VHF) telemetry loggers, or even obIn addition to accessing feedr tools through a user interface, the R has a major drawback of being challenging to learn, which again animalnexus.ca site provides access to a database of raw RFID data. creates problems of accessibility. In contrast, other systems that rely These data are comprised of contributed data from different projects, purely on easy-­to-­use graphical user interfaces may lack the complex- species, and locations. A large part of this database is data from our ity and flexibility that more advanced users desire. Fortunately, a new ongoing project at Thompson Rivers University (TRU) in Kamloops, R project, Shiny Web applications (apps), has been recently developed BC, Canada. These data are actively collected via WiFi from a suite of to provide a framework for creating user-­friendly, R-­based Web apps RFID-­enabled feeders spread across campus. A snapshot of current (Chang, Cheng, Allaire, Xie, & McPherson, 2016). activity is always visible on the animalnexus.ca homepage. | 7887 LAZERTE et al. F I G U R E 3 Access to publicly available RFID data from the database hosted at animalnexus.ca. Accessible through the “Database” tab 2 | GENERAL USAGE OF FEEDR under the “Import” tab (Figure 1 top row). Note that data imported on- feedr is an R package with a suite of functions for loading, transform- ture use by the animalnexus.ca project. Alternatively, those who would in three different ways (Figure 1): (1) R enthusiasts can use feedr database by contacting the development team (SEL, DJH or MWR). complement and simplify their scripting in R by launching standalone the required columns: animal_id, logger_id, and time (lat and line are only available to the user and is not accessed or stored for fu- ing, and visualizing RFID data. feedr functionality can be accessed like to share their data can contribute it to the online animalnexus.ca functions directly through scripting in R; (2) intermediate users can Raw data can be loaded directly for use by feedr provide it has Shiny apps; (3) nonspecialist users, including students or citizen scientists, can use the publicly accessible animalnexus.ca site to load and manipulate data, access the database, or get up-­to-­date information on the movements of local birds and other project contributions without having to use R at all. Currently, our package handles RFID data collected from loggers that continuously record the presence of an individual. These raw reads can be imported and then transformed to visits, after which they can be transformed to other measures such as movements or presence around a logger. The following coding examples are designed to be run in the R console after loading the feedr package (library(feedr)). All lon are also required for visualizations). Users can then format their data with the feedr function load_format(). raw <- read.csv(“finch_data.csv”) raw <- load_format(raw) By default load_format expects the time column to be formatted as Year-­Month-­Day Hour:Min:Sec (e.g. 2017-­05-­21 14:50:43), but different time formats can be specified with the time_format argument which indicates the order of year (y), month (m), day (d), hour (H), min (M), sec (S), and, if necessary AM/ data sets used here are available for download and are included in the PM (p). feedr functions extract date/times using the lubridate feedr package (see Data Availability). For an example of a complete is quite flexible. For example, time formatted as “31-­12-­17 09:12 typical workflow, see the R script in Supporting Information. 2.1 | Loading data Data can be imported through R scripting, through a standalone Shiny app (function ui_import(); Figure 2), or through animalnexus.ca package (Grolemund & Wickham, 2011), and thus, the exact format pm” would be extracted using: raw <- load_format(raw, time_format = “dmy HM p”) Data can also be loaded with the load_raw_all() function, which loads and combines all data files in a folder. Here, each data file 7888 | LAZERTE et al. FIGURE 4 User interface for transforming data. Accessible through the “Transform” tab at animalnexus.ca or by calling the function ui_trans() is expected to correspond to a single RFID logger (there can be more from other systems. For example, the default is for data columns to than one data file per logger). Each file should have three unlabeled be separated by whitespace, but the sep argument can be changed columns corresponding to animal_id, date, and time (time in this case including only hours, minutes, and seconds). raw_all <- load_raw_all(r_dir = “./data-folder/”) The details argument specifies where the logger_id can be found. details = 1 (default) indicates that the logger_id is to “,” or “;” to reflect comma-­ or semicolon-­separated data. Similarly to the load_format() function, the combined format of the date and time columns can be specified by changing the time_format argument (defaults to “mdy HMS”). raw_all <- load_raw_all(r_dir = “./data-folder/”, time_format = “dmy HMS”, in the first line of each file. For more advanced users, details = sep = “,”) 0 extracts logger_id from the file name, and users can supply a regular expression to the logger_pattern argument to extract only parts of the file name (otherwise the entire file name is used). raw_all <- load_raw_all(r_dir = “./data-folder/”, details = 0) By default, data are expected to be formatted as from TRU RFID-­ enabled feeders, but there is enough flexibility to specify formats Although raw logger files do not normally contain logger coordinates, they can be added to the data in several ways. First, specifying details = 2 extracts the logger_id from the first line of each file and also extracts the logger coordinates in the format of lat, lon from the second line of each file. Thus if users add logger coordinates to their files, they will be automatically extracted. | 7889 LAZERTE et al. T A B L E 1 Example of raw house finch RFID data. animal_id refers to the unique PIT tag code logged by an RFID receiver. time is the time at which the PIT tag was detected. logger_id is the unique ID of the RFID logger. species and sex are the species and sex of the animal. lat and lon are the latitude and longitude of the corresponding RFID-­enabled feeder animal_id time logger_id species sex lon lat date 041868E9A8 2015-­10-­01 17:38:52 2100 House Finch F −­120.3624 50.66896 2015-­10-­01 041868E9A8 2015-­10-­01 17:38:54 2100 House Finch F −­120.3624 50.66896 2015-­10-­01 041868E9A8 2015-­10-­01 17:38:56 2100 House Finch F −­120.3624 50.66896 2015-­10-­01 041868E9A8 2015-­10-­01 17:38:58 2100 House Finch F −­120.3624 50.66896 2015-­10-­01 041868E9A8 2015-­10-­01 17:39:00 2100 House Finch F −­120.3624 50.66896 2015-­10-­01 041868E9A8 2015-­10-­01 17:39:12 2100 House Finch F −­120.3624 50.66896 2015-­10-­01 041868E9A8 2015-­10-­01 17:40:53 2100 House Finch F −­120.3624 50.66896 2015-­10-­01 041868E9A8 2015-­10-­01 17:45:00 2700 House Finch F −­120.3632 50.66909 2015-­10-­01 041868E9A8 2015-­10-­01 17:45:02 2700 House Finch F −­120.3632 50.66909 2015-­10-­01 041868E9A8 2015-­10-­01 17:45:04 2700 House Finch F −­120.3632 50.66909 2015-­10-­01 raw_all <- load_raw_all(r_dir = “./data-folder/”, details = 2) one individual is forced away from the feeder by another, presumably more dominant, individual (cf Adelman et al., 2015). The disp() function summarizes these events using a time cutoff between successive visits by Alternatively, the imported data can be merged with a logger index file containing the columns logger_id, lat and lon. logger_index <- read.csv(“logger_index.csv”) raw_all <- load_raw_all(r_dir = “./data-folder/”) raw_all <- merge(raw, logger_index, by = “logger_id”) Those who would like to use the data stored in the online database can either access the data at animalnexus.ca by clicking on the “Database” tab (Figure 3) or can use the dl_data() function: raw_dl <- dl_data(start = “2015-09-01”, end = “2015-11-01”) 2.2 | Transformations Once loaded, RFID data can be converted into other data types using various feedr transformation functions through R scripting, by launch- ing a standalone Shiny app from R (function ui_trans(); Figure 4), or by clicking on the “Transformations” tab on the animalnexus.ca site (Figure 1 middle row). Most users would first use the visits() function to consoli- dates scans of individual RFID tags (e.g., Table 1) into logger visits (e.g., Table 2). RFID reads are consolidated if the time between two reads is less than a particular cutoff (defaults to 3 s; specified by the bw argument). In TRU RFID-­enabled feeders, the receiver is embedded in the perch; thus, RFID reads reflect time the individual was at the feeder. v <- visits(r = raw, bw = 4) different individuals (defaults to 2 s; specified by the bw argument). There are many R packages for calculating dominance; thus, we provide sev- eral conversion functions to convert the output of the disp() function to formats compatible with these packages. For example, our function convert_anidom() formats data for use by the aniDom package which calculates dominance hierarchies based on Elo scores (Farine & Sanchez-­Tojar, 2017). The convert_dominance() function formats data for the Dominance package which calculates an average dominance index (Krueger & Krueger, 2016). Finally, the convert_perc() function formats data for the Perc package, which calculates dominance from networks based on percolation and conductance (Fujii et al., 2016). d <- disp(v, bw = 1) i <- convert_anidom(d) i <- convert_dominance(d) i <- convert_perc(d) Individual movements can be tracked between loggers (move(); Table 3), or each individual’s visits to a specific logger can be lumped together into a measure of “presence” (presence(); Table 4). Presence reflects the amount of time an individual spent making regular visits to a logger. Visits are considered regular if the time between them was less than a particular cutoff (defaults to 15 min; specified by the bw argument). Presence contrasts with visits, which reflect the amount of time actually spent in range of a logger (if a feeder, presumably on the perch). m <- move(v) p <- presence(v, bw = 20) Note that move() and presence() are calculated individually with- out reference to other animals that may also be present. For users who Visit data can then be transformed into a variety of different data types wish to infer group membership by examining covisits to a logger, we pro- (Figure 1 left panel). For example, depending on the behavior of a species vide the convert_asnipe() function which formats loaded data for and if the logger is part of a feeder, displacement events may occur when use by the gmmevents() and get_associations_points_tw() 7890 | animal_id LAZERTE et al. date start end T A B L E 2 Example of house finch visit data, data output from the visits() function. These data show multiple reads collapsed into individual visits. animal_id refers to the unique PIT tag code logged by an RFID receiver. date is the day on which the visit was started. start and end are the start and end times of the visit made to an RFID-­enabled feeder. logger_id is the unique ID of the RFID logger. Note that for simplicity, some columns with specific animal or logger information have been omitted logger_id 041868E9A8 2015-­10-­01 2015-­10-­01 17:38:52 2015-­10-­01 17:39:00 2100 041868E9A8 2015-­10-­01 2015-­10-­01 17:39:12 2015-­10-­01 17:39:12 2100 041868E9A8 2015-­10-­01 2015-­10-­01 17:40:53 2015-­10-­01 17:40:53 2100 041868E9A8 2015-­10-­01 2015-­10-­01 17:45:00 2015-­10-­01 17:45:56 2700 041868E9A8 2015-­10-­01 2015-­10-­01 17:46:31 2015-­10-­01 17:46:31 2700 041868E9A8 2015-­10-­01 2015-­10-­01 17:51:03 2015-­10-­01 17:51:16 2700 041868E9A8 2015-­10-­01 2015-­10-­01 17:51:42 2015-­10-­01 17:51:58 2700 041868E9A8 2015-­10-­01 2015-­10-­01 17:52:51 2015-­10-­01 17:53:07 2700 041868E9A8 2015-­10-­01 2015-­10-­01 17:53:41 2015-­10-­01 17:54:57 2700 041868E9A8 2015-­10-­01 2015-­10-­01 17:56:42 2015-­10-­01 17:56:42 2700 T A B L E 3 Example of house finch movements between loggers, data output from the move() function. Each movement is described by two rows: when the individual left a logger and when it arrived at a new logger. animal_id refers to the unique PIT tag code logged by an RFID receiver. date is the day on which the event (either arriving or leaving) was made. time is the time of the specific event (arrived/left). logger_ id is the unique ID of the RFID logger the bird arrived at or left from. direction is the direction of the movement with respect to the particular RFID logger (arrived/left). move_id identifies specific movement events for a particular individual. move_dir is a category specifying to and from which RFID loggers the individual was moving. move_path is a category specifying between which RFID loggers the individual was moving (independent of direction). strength reflects the connectivity between loggers and is the inverse of the time it took to arrive at a logger after having left the previous logger. Note that for simplicity, some columns with specific bird or logger information have been omitted animal_id date time logger_id direction move_id move_dir move_path strength 041868E9A8 2015-­10-­01 2015-­10-­01 17:40:53 2100 Left 1 2100_2700 2100_2700 14.57 041868E9A8 2015-­10-­01 2015-­10-­01 17:45:00 2700 Arrived 1 2100_2700 2100_2700 14.57 041868E9A8 2015-­10-­01 2015-­10-­01 17:56:42 2700 Left 2 2700_2200 2200_2700 0.06 041868E9A8 2015-­10-­02 2015-­10-­02 10:57:00 2200 Arrived 2 2700_2200 2200_2700 0.06 041868E9A8 2015-­10-­06 2015-­10-­06 14:24:50 2200 Left 3 2200_2700 2200_2700 0.60 041868E9A8 2015-­10-­06 2015-­10-­06 16:05:40 2700 Arrived 3 2200_2700 2200_2700 0.60 T A B L E 4 Finch presence at different loggers, data output from the presence() function. animal_id refers to the unique PIT tag code logged by an RFID receiver. date is the day on which the start of the presence bout was recorded. logger_id is the unique ID of the RFID logger the bird arrived at or left from. start and end are the start and end times of the period of presence. length is the length of the period in minutes (end time minus start time). Note that for simplicity, some columns with specific bird or logger information have been omitted animal_id date logger_id start end 041868E9A8 2015-­10-­01 2100 2015-­10-­01 17:38:52 2015-­10-­01 17:40:53 length 2.016667 mins 041868E9A8 2015-­10-­01 2700 2015-­10-­01 17:45:00 2015-­10-­01 17:56:42 11.700000 mins 041868E9A8 2015-­10-­02 2200 2015-­10-­02 10:57:00 2015-­10-­02 11:11:43 14.716667 mins 041868E9A8 2015-­10-­02 2200 2015-­10-­02 12:45:37 2015-­10-­02 13:06:27 20.833333 mins 041868E9A8 2015-­10-­02 2200 2015-­10-­02 14:22:58 2015-­10-­02 14:27:30 4.533333 mins functions in the asnipe package (Farine, 2017). These functions allow for given time intervals (defaults to a resolution of 15 min; specified by the models or using a time window approach, respectively. daily (24-­h) activity patterns using the daily() function. users to assign group membership by either applying Gaussian mixture i <- convert_asnipe(r, fun = “gmmevents”) i <- convert_asnipe(r, fun = “get_associations_points_tw”) Finally, activity patterns can also be inferred by summarizing the times at which individuals’ presence is detected by the logger. The activity() function transforms presence data into binary active/inactive data scored res argument). This binary activity can then be summarized into average a <- activity(p, res = 5) da <- daily(a) Alternatively, users can use the convert_activity() func- tion to create a list of time values suitable for use in the fitact() function from the activity package which calculates average daily activity patterns using circular kernel probability density functions. | 7891 LAZERTE et al. 50.671 Average time (min) 50.670 50 100 Latitude 150 200 50.669 Average no. movements 5 10 50.668 50.667 −120.366 −120.364 Longitude −120.362 −120.360 F I G U R E 5 Static map of presence at, and movements between, loggers summarized across 11 individuals over 42 days. Circles represent total time present at each RFID logger (small yellow = less time; large red = more time), and lines represent path use (narrow yellow = less use; wide red = more use). Black circles indicate logger locations. Created using the map_ggmap() function 2.3 | Visualizations feedr also provides tools for visually summarizing the time pre- map_leaflet(p = p, m = m, summary = “sum”) The second, summary = “sum_indiv”, calculates total time sent at, and movements between, loggers. As with transformations, and total movements, but averages by the number of individuals. Note visualizations can be constructed using the feedr functions directly that other arguments, such as legend titles, can also be specified (static through R scripting, by launching the standalone Shiny app from R (function ui_animate(); see below), or through the animalnexus.ca site under the “Visualizations” tab (Figure 1 bottom row). Visualizations created using the base feedr package functions via R scripting are more customizable and allow users to create static maps using map_ggmap() (i.e., images; through the ggmap package; Kahle & Wickham, 2013) or interactive maps using map_leaflet() (i.e., maps that can be panned and zoomed; through the leaflet package; Cheng & Xie, 2016). map Figure 5; interactive map Figure 6). map_ggmap(p = p, m = m, summary = “sum_indiv”, p_title = “Average Time (min)”, m_title = “Average no. movements”) map_leaflet(p = p, m = m, summary = “sum_indiv”, p_title = “Average Time (min)”, m_title = “Average no. movements”) Visualizations always represent summarized data and users can specify one of three built in summaries. The first, summary = “sum”, simply expresses the total time spent around a logger and the total Alternatively, visual summaries can be created for specific individuals with map_ggmap using summary = “indiv” and by specifying number of movements made between loggers. animal_id’s in the which argument (Figure 7): map_ggmap(p = p, m = m, summary = “sum”) map_ggmap(p = p, m = m, summary = “indiv”, 7892 | LAZERTE et al. Average time (min) 50 100 150 200 Average no. movements 2 4 6 8 10 12 14 Leaflet | Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community p_scale = 0.75, #tweak scaling F I G U R E 6 Interactive map of presence at and movements between loggers summarized across 11 individuals over 42 days. Circles represent total time present at each logger (small yellow = less time; large red = more time), and lines represent path use (narrow yellow = less use; wide red = more use). White-­outlined black circles represent logger locations. Created using the map_leaflet() presence/absence of a gap between two feeders, gap distances, and p_title = “Total Time (min)”, gap type or habitat type. which = c(“06200003AA”, “06200004F8”)) cause the preliminary data collected from two sites in this exper- m_title = “Total no. movements”, This is a more advanced example of RFID data manipulation beiment need to be kept separate. As the experiments were located Users wanting more control over summary types can also summa- in nearby sites, some individuals participated in both experiments, rize their data themselves and use the summary = “none” option but we do not want to consider these movements between experi- Finally, simple visual animations can also be created. These can ei- mations on each subset by hand, but using summarizing functions ther be created through animalnexus.ca under the “Visualizations” tab, or from the dplyr R package we are able to simultaneously trans- (see the next example for more details). through a standalone Shiny Web app launched with the R function ui_ animate(). This function will launch a local Shiny app which allows the user to specify the details of the animation (e.g., cumulative vs. instantaneous, all individuals vs. specific individuals, type of summary; Figure 8). ments. We could have separated the data and performed transfor- form each experiment separately (Wickham & Francois, 2016). Here, we use the group_by() function to first group the data according to the column experiment, and we then apply the trans- formation functions to each data grouping using the do() function. The %>% is a pipe that sends output from one line to the next line, 2.4 | An advanced example of a scientific application: Gap-­crossing and the period (.) reflects where the input should go in the do() function. We use ungroup() at the end to remove any remaining grouping. Essentially, the following code loads the data, groups by In order to assess gap-­crossing in black-­capped chickadees (Poecile experiment, and transforms into visits, followed by presence and atricapillus), Bailey et al. (2016) used four RFID-­enabled feeders set then movements. out in a square pattern surrounding a man-­made gap in the forest (e.g., road, powerline). Loggers recorded visits by PIT-­tagged chickadees for 2 weeks, after which the setup was moved to a new site and the experiment repeated. Thus, Bailey et al. (2016) monitored the time spent at, and movements between, the different feeders. Movements were then compared within and among sites, while assessing the library(dplyr) chickadees <- read.csv(“chickadee_data.csv”) chickadees <- load_format(chickadees, tz = “America/Vancouver”) | 7893 LAZERTE et al. Total time (min) 06200003AA 06200004F8 300 50.671 600 Latitude 50.670 900 50.669 Total no. movements 50.668 20 40 50.667 −120.366 −120.364 −120.362 −120.360 −120.366 Longitude −120.364 −120.362 −120.360 60 F I G U R E 7 Static map of presence at and movements between loggers summarized for two individuals over 26 and 42 days, respectively. Circles represent total time present at each logger (small yellow = less time; large red = more time), and lines represent path use (narrow yellow = less use; wide red = more use). Black dots indicate logger locations. Created using the map_ggmap() function # Transform the raw data into visit data # separately for each experiment (site) v <- chickadees %>% group_by(experiment) %>% do(visits(.)) %>% ungroup() # Transform the visit data into movements and # presence data p <- v %>% group_by(experiment) %>% do(presence(.))%>% ungroup() summarize(amount = sum(length) / animal_n[1]) %>% ungroup() # Path use standardized by the number of birds, # per experiment m_avg <- m %>% group_by(experiment, move_path, logger_id, lat, lon) %>% summarize(path_use = length(move_path) / animal_n[1]) %>% ungroup() Now, we are able to plot the data together on the same map, but m <- v %>% without showing any movements between experiments (Figure 9). group_by(experiment) %>% do(move(.))%>% ungroup() map_leaflet(p = p_avg, m = m_avg, summary = “none”, p_title = “Average Time (min)”, Next, in order to maintain the separation of experiments, we summa- m_title = “Average no. movements”) rize the data “by hand” using the summarize() function, also from the dplyr package. To summarize the total sum of presence at each logger in each experiment, we first group by experiment as well as by logger_id (including logger specific information such as lat and lon). To calculate the total number of movements made between each logger, we As such, using the feedr package in conjunction with the dplyr package we are able to perform fairly complex data transformations and summaries, and then visualize the results of these experiments. also group by move_path. Each total is averaged by the number of individuals, calculated previously by the visits() function as animal_n. # Average time present per bird, per experiment p_avg <- p %>% group_by(experiment, logger_id, lat, lon) %>% 2.5 | Other applications: citizen science and education In addition to numerous other scientific applications, the animalnexus. ca site and database can also be used to facilitate citizen science and/ 7894 | LAZERTE et al. F I G U R E 8 User interface for creating animations of presence at and movements between loggers over time. Accessible through the ui_animate() function or through animalnexus.ca under the “Visualizations” tab or provide educational opportunities for participants and students. At participating in science through inquiry-­based learning (Barron & TRU in Kamloops, BC, we are expanding our network of RFID-­enabled Darling-­Hammond, 2008; Jenkins, 2011). By working on animalnexus. feeders into residential areas as part of a citizen science project exam- ca, student engagement can be improved by having students work ining the impacts of urbanization on avian behavior and ecology. All with real data that has not been carefully curated or processed to pro- data will be automatically added to the openly available database on vide preconceived answers. animalnexus.ca. It is our hope that this project will engage the interest of community members. We are also adding contributions from other projects covering dif- 3 | FUTURE DIRECTIONS ferent species from different locations to our database. As a result, this database will become a powerful teaching tool. It is often suggested that students are more engaged in science when they feel that their work is connected to the “real world” and when they are actively Currently, the feedr package can be used for transformations and vis- ualizations. However, one of the powerful aspects of FOSS is the ability to continually add and integrate functionality, such as community | 7895 LAZERTE et al. Total time (min) 150 200 250 300 Total no. movements 2 4 6 8 10 12 14 16 18 F I G U R E 9 Gap-­crossing in black-­ capped chickadees (Poecile atricapillus) measured by movements between RFID-­ enabled feeders and visualized using the map_leaflet() function from the feedr package. Data are summarized across 20 and 16 individuals over 14 days in each experiment (site), respectively Leaflet | Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community contributions as well as analyses from existing and future R packages. and technical tutorials can be found at https://animalnexus.github.io/ Based on user input, we plan to add more types of transformations to feedr/. the package and more customizations to the animalnexus.ca site. We also plan to include the use of other RFID data formats, such as systems that have start and end times of visit already calculated, or nest 5 | DATA AVAILABILITY boxes that record visits as in or out. All data used to illustrate feedr are available in Supporting Information. 4 | PACKAGE AVAILABILITY In addition, the chickadee and finch data sets are part of the feedr package, accessible by calling finches_lg, or chickadees from the R console. As of writing, feedr v0.9.0 is available for download on github and can be downloaded and installed directly in R using the devtools package: install.packages(“devtools”) devtools::install_github(“animalnexus/feedr”) AC KNOW L ED G M ENTS The assistance of Jamie Shippit, Alistair Sutter, Brandon Turner, and Jerin Roberts on this project is greatly appreciated. Matt Betts provided data for testing and visualizing. We thank Eli Bridge for For more specific installation details or for troubleshooting, please his pioneering work on RFID systems, including ensuring this tech- see the README (http://github.com/animalnexus/feedr). More specific nology is open-­source and available to all scientists. Meetings and 7896 | conversations with Eli were instrumental for conducting this project. We would also like to thank Damien Farine and John Eadie for their thoughtful comments and suggestions for the manuscript and software. Funding was provided by the Natural Sciences and Engineering Research Council of Canada through Discovery Grants (MWR, DJH, KAO) and an Engage Grant (KAO) in partnership with Environmental Dynamics Inc. Thompson Rivers University also provided funding through an Open Learning Research Award (MWR, MP, DJH), through Internal Research Fund Awards (MWR, DJH), and through provisioning the servers that host animalnexus.ca and its database (DJH). CO NFLI CT OF I NTE RE ST None declared. REFERENCES Adelman, J. S., Moyers, S. C., Farine, D. R., & Hawley, D. M. (2015). Feeder use predicts both acquisition and transmission of a contagious pathogen in a North American songbird. Proceedings of the Royal Society B: Biological Sciences, 282, 20151429. Bailey, J. M., LaZerte, S. E., Paetkau, M., Reudink, M. W., & Otter, K. A. (2016) Using radio frequency identification (RFID) technology to investigate gap crossing decisions in chickadees. Oral Presentation, North American Ornithological Conference. Washington DC, USA. Barron, B., & Darling-Hammond, L. (2008). Teaching for meaningful learning: A review of research on inquiry-based and cooperative learning. In L. Darling-Hammond, B. Barron, P. D. Pearson, A. H. Schoenfeld, E. K. Stage, T. D. Zimmerman,G. N. Cervetti, & J. Tilson (Eds.), Powerful learning: What we know about teaching for understanding. San Francisco: Jossey-Bass. Bartsch, C., Weiss, M., & Kipper, S. (2015). Multiple song features are related to paternal effort in common nightingales. BMC Evolutionary Biology, 15, 115. Bonter, D. N., & Bridge, E. S. (2011). Applications of radio frequency identification (RFID) in ornithological research: A review: RFID Applications in Ornithology. Journal of Field Ornithology, 82, 1–10. Bonter, D. N., Zuckerberg, B., Sedgwick, C. W., & Hochachka, W. M. (2013). Daily foraging patterns in free-­living birds: Exploring the predation– starvation trade-­off. Proceedings of the Royal Society of London B: Biological Sciences, 280, 20123087. Bridge, E. S., & Bonter, D. N. (2011). A low-­cost radio frequency identification device for ornithological research: Low-­Cost RFID Reader. Journal of Field Ornithology, 82, 52–59. Chang, W., Cheng, J., Allaire, J., Xie, Y., & McPherson, J. (2016) shiny: Web Application Framework for R. https://CRAN.R-project.org/ package=shiny. Cheng, J., & Xie, Y. (2016) leaflet: Create Interactive Web Maps with the JavaScript ‘Leaflet’ Library. http://rstudio.github.io/leaflet/. LAZERTE et al. Cooper, C. B., Dickinson, J., Phillips, T., & Bonney, R. (2007). Citizen science as a tool for conservation in residential ecosystems. Ecology and Society, 12, 11. 00183. Dickinson, J. L., Shirk, J., Bonter, D., Bonney, R., Crain, R. L., Martin, J., … Purcell, K. (2012). The current state of citizen science as a tool for ecological research and public engagement. Frontiers in Ecology and the Environment, 10, 291–297. Farine, D. R. (2017) asnipe: Animal Social Network Inference and Permutations for Ecologists. https://CRAN.R-project.org/ package=asnipe. Farine, D. R., Firth, J. A., Aplin, L. M., Crates, R. A., Culina, A., Garroway, C. J., … Sheldon, B. C. (2015). The role of social and ecological processes in structuring animal populations: A case study from automated tracking of wild birds. Royal Society Open Science, 2, 150057. Farine, D. R., & Sanchez-Tojar, A. (2017) aniDom: Inferring Dominance Hierarchies and Estimating Uncertainty. https://CRAN.R-project.org/ package=aniDom. Fujii, K., Jin, J., Shev, A., Beisner, B., McCowan, B., & Fushing, H. (2016) Perc: Using Percolation and Conductance to Find Information Flow Certainty in a Direct Network. https://CRAN.R-project.org/package=Perc. Grolemund, G., & Wickham, H. (2011). Dates and times made easy with lubridate. Journal of Statistical Software, 40, 1–25. Jenkins, L. L. (2011). Using citizen science beyond teaching science content: A strategy for making science relevant to students’ lives. Cultural Studies of Science Education, 6, 501–508. Johnson, L. S., Hebert, R. M., Napolillo, F. M., & Allen, A. (2013). The process of fledging in the Mountain Bluebird. Journal of Field Ornithology, 84, 367–376. Kahle, D., & Wickham, H. (2013). ggmap: Spatial visualization with ggplot2. R Journal, 5, 144–161. Krueger, K., & Krueger, K. (2016) Dominance: ADI (Average Dominance Index), Social Network Graphs with Dual Directions, and Music Notation Graph. https://CRAN.R-project.org/package=Dominance. R Development Core Team (2008) R: A language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing. http://www.R-project.org Wickham, H., & Francois, R. (2016) dplyr: A Grammar of Data Manipulation. https://CRAN.R-project.org/package=dplyr S U P P O RT I NG I NFO R M AT I O N Additional Supporting Information may be found online in the supporting information tab for this article.      How to cite this article: LaZerte SE, Reudink MW, Otter KA, et al. feedr and animalnexus.ca: A paired R package and user-­friendly Web application for transforming and visualizing animal movement data from static stations. Ecol Evol. 2017;7:7884–7896. https://doi.org/10.1002/ece3.3240