DOI: 10.6084/m9.figshare.2066784.v1
title: Example of how to manually extract incubation bouts from interactive plots of raw data - R-CODE and DATA

description: {# General information<br># The script runs with R (Version 3.1.1; 2014-07-10) and packages plyr (Version 1.8.1), XLConnect (Version 0.2-9), utilsMPIO (Version 0.0.25), sp (Version 1.0-15), rgdal (Version 0.8-16), tools (Version 3.1.1) and lattice (Version 0.20-29)<br># --------------------------------------------------------------------------------------------------------<br># Questions can be directed to: Martin Bulla (bulla.mar@gmail.com)<br># --------------------------------------------------------------------------------------------------------<br> <br> # Data collection and how the individual variables were derived is described in:<br> #Steiger, S.S., et al., When the sun never sets: diverse activity rhythms under continuous daylight in free-living arctic-breeding birds. Proceedings of the Royal Society B: Biological Sciences, 2013. 280(1764): p. 20131016-20131016.<br> # Dale, J., et al., The effects of life history and sexual selection on male and female plumage colouration. Nature, 2015.<br> # Data are available as Rdata file<br> # Missing values are NA.<br> <br># --------------------------------------------------------------------------------------------------------<br># For better readability the subsections of the script can be collapsed <br># --------------------------------------------------------------------------------------------------------<br>}<br>{# Description of the method <br> # 1 - data are visualized in an interactive actogram with time of day on x-axis and one panel for each day of data<br> # 2 - red rectangle indicates the active field, clicking with the mouse in that field on the depicted light signal generates a data point that is automatically (via custom made function) saved in the csv file. For this data extraction I recommend, to click always on the bottom line of the red rectangle, as there is always data available due to a dummy variable ("lin") that creates continuous data at the bottom of the active panel. The data are captured only if greenish vertical bar appears and if new line of data appears in R console). <br> # 3 - to extract incubation bouts, first click in the new plot has to be start of incubation, then next click depict end of incubation and the click on the same stop start of the incubation for the other sex. If the end and start of incubation are at different times, the data will be still extracted, but the sex, logger and bird_ID will be wrong. These need to be changed manually in the csv file. Similarly, the first bout for a given plot will be always assigned to male (if no data are present in the csv file) or based on previous data. Hence, whenever a data from a new plot are extracted, at a first mouse click it is worth checking whether the sex, logger and bird_ID information is correct and if not adjust it manually. <br> # 4 - if all information from one day (panel) is extracted, right-click on the plot and choose "stop". This will activate the following day (panel) for extraction. <br> # 5 - If you wish to end extraction before going through all the rectangles, just press "escape".<br> }<br>{# Annotations of data-files from turnstone_2009_Barrow_nest-t401_transmitter.RData <br>dfr<br>-- contains raw data on signal strength from radio tag attached to the rump of female and male, and information about when the birds where captured and incubation stage of the nest<br>1. who: identifies whether the recording refers to female, male, capture or start of hatching<br>2. datetime_: date and time of each recording<br>3. logger: unique identity of the radio tag <br>4. signal_: signal strength of the radio tag<br>5. sex: sex of the bird (f = female, m = male)<br>6. nest: unique identity of the nest<br>7. day: datetime_ variable truncated to year-month-day format<br>8. time: time of day in hours<br>9. datetime_utc: date and time of each recording, but in UTC time<br>10. cols: colors assigned to "who"<br>--------------------------------------------------------------------------------------------------------<br><br>m<br>-- contains metadata for a given nest<br>1. sp: identifies species (RUTU = Ruddy turnstone)<br>2. nest: unique identity of the nest<br>3. year_: year of observation<br>4. IDfemale: unique identity of the female<br>5. IDmale: unique identity of the male<br>6. lat: latitude coordinate of the nest<br>7. lon: longitude coordinate of the nest<br>8. hatch_start: date and time when the hatching of the eggs started <br>9. scinam: scientific name of the species<br>10. breeding_site: unique identity of the breeding site (barr = Barrow, Alaska)<br>11. logger: type of device used to record incubation (IT - radio tag)<br>12. sampling: mean incubation sampling interval in seconds<br>--------------------------------------------------------------------------------------------------------<br><br>s<br>-- contains metadata for the incubating parents<br>1. year_: year of capture<br>2. species: identifies species (RUTU = Ruddy turnstone)<br>3. author: identifies the author who measured the bird<br>4. nest: unique identity of the nest<br>5. caught_date_time: date and time when the bird was captured<br>6. recapture: was the bird capture before? (0 - no, 1 - yes)<br>7. sex: sex of the bird (f = female, m = male)<br>8. bird_ID: unique identity of the bird<br>9. logger: unique identity of the radio tag <br>--------------------------------------------------------------------------------------------------------<br>}<br> <br>