figshare
Browse
1/1
2 files

Example of how to manually extract incubation bouts from interactive plots of raw data - R-CODE and DATA

dataset
posted on 2016-01-22, 16:42 authored by Martin BullaMartin Bulla
{# General information
# 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)
# --------------------------------------------------------------------------------------------------------
# Questions can be directed to: Martin Bulla (bulla.mar@gmail.com)
# --------------------------------------------------------------------------------------------------------
 
  # Data collection and how the individual variables were derived is described in:
            #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.
            # Dale, J., et al., The effects of life history and sexual selection on male and female plumage colouration. Nature, 2015.
  # Data are available as Rdata file
  # Missing values are NA.
 
# --------------------------------------------------------------------------------------------------------
# For better readability the subsections of the script can be collapsed  
# --------------------------------------------------------------------------------------------------------
}
{# Description of the method    
    # 1 - data are visualized in an interactive actogram with time of day on x-axis and one panel for each day of data
    # 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).  
    # 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.
    # 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.
    # 5 - If you wish to end extraction before going through all the rectangles, just press "escape".
    }
{# Annotations of data-files from turnstone_2009_Barrow_nest-t401_transmitter.RData
dfr
-- 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
1. who: identifies whether the recording refers to female, male, capture or start of hatching
2. datetime_: date and time of each recording
3. logger: unique identity of the radio tag
4. signal_: signal strength of the radio tag
5. sex: sex of the bird (f = female, m = male)
6. nest: unique identity of the nest
7. day: datetime_ variable truncated to year-month-day format
8. time: time of day in hours
9. datetime_utc: date and time of each recording, but in UTC time
10. cols: colors assigned to "who"
--------------------------------------------------------------------------------------------------------

m
-- contains metadata for a given nest
1. sp: identifies species (RUTU = Ruddy turnstone)
2. nest: unique identity of the nest
3. year_: year of observation
4. IDfemale: unique identity of the female
5. IDmale: unique identity of the male
6. lat: latitude coordinate of the nest
7. lon: longitude coordinate of the nest
8. hatch_start: date and time when the hatching of the eggs started
9. scinam: scientific name of the species
10. breeding_site: unique identity of the breeding site (barr = Barrow, Alaska)
11. logger: type of device used to record incubation (IT - radio tag)
12. sampling: mean incubation sampling interval in seconds
--------------------------------------------------------------------------------------------------------

s
-- contains metadata for the incubating parents
1. year_: year of capture
2. species: identifies species (RUTU = Ruddy turnstone)
3. author: identifies the author who measured the bird
4. nest: unique identity of the nest
5. caught_date_time: date and time when the bird was captured
6. recapture: was the bird capture before? (0 - no, 1 - yes)
7. sex: sex of the bird (f = female, m = male)
8. bird_ID: unique identity of the bird
9. logger: unique identity of the radio tag
--------------------------------------------------------------------------------------------------------
}
   

History