pamPREP: Prepare data for analysis by deriving summary statistics

View source: R/pamPREP.R

pamPREPR Documentation

Prepare data for analysis by deriving summary statistics

Description

This function summarises the data based on different patterns such as sustained acitivity, sustained pressure changes, etc... and extracts these from the data as a timetable. It then creates summary statics for each of these periods or events, such as cumulative altitude change, mean pitch etc...

Usage

pamPREP(
  dta,
  availavariable = c("pressure", "light", "acceleration", "magnetic", "temperature"),
  Pdiff_thld = 2,
  light_thld = 1,
  method = "pressure",
  twl,
  interp = FALSE,
  tz = "UTC"
)

Arguments

dta

PAM data to be used in the analysis e.g. str(hoopoe)

availavariable

Variables to be used to derive metrics for classification. must have "pressure", but ideally availavariable = c("pressure", "light", "acceleration") if any of these are incomplete, do not use them

Pdiff_thld

Pressure threshold. Only used when method="pressure". This if pressure changes more than e.g. 2hpa over 30 minutes, then the bird is flying

light_thld

Light threshold. Only used when method="darkness". This is the the light threshold for finding darkness, should be the same as for GeoLight::twilightCalc

method

The type of event that is being classified. Can be "flap", "endurance", "rest", "pressure","light" or "darkness".If method = "pressure" then it find periods where pressure has changed more than a certain threshold. If method = "flap", then the algorithm looks for sustained periods of high activity. If method = "endurance" it looks for sustained activity (low or high). If method = "rest+ then it looks for sustained periods of no activity. If method = "light" if looks for periods of sustained sunlight. If method = "darkness" if looks for periods of darkness

twl

twilight estimates formatted according to twilightCalc in GeoLight package

interp

whether or not to interpolate the magnetic data. If FALSE, then NAs are left in the dataset

tz

Timeuzone. default is "UTC"

Value

a dataframe of derives metrhics based on pressure:

date : Date (without time)

start : Start time and date of the event, POSIXct format

end : Time and date that the event finished, POSIXct format

duration : How long it lasted (in hours)

total_daily_duration : The total duration of all the events that occured that day (in hours)

total_daily_event_number : The total number of events which occured that day

cum_pressure_change : The cumulative change in atmospheric pressure during that event (in hectopascals)

cum_altitude_change : The cumulative change in altitude during that event (in metres)

cum_altitude_up : The cumulative number of metres that the bird went upwards during that event

total_daily_P_change : The cumulative change in atmospheric pressure for all the events for that date (in hectopascals)

P_dep_arr : The difference between atmospheric pressure at the start of the event, and at the end (in hectopascals)

pressure_range : The total range of the atmospheric pressure during that event (maximum minus miniimum - in hectopascals)

altitude_range : The total altitude range during that event (maximum minus miniimum - in metres)

mean_night_P : The mean pressure during the night before the event took place (in hectopascals)

sd_night_P : The standard deviation of pressure the night before the event took place (in hectopascals)

mean_nextnight_P : The mean pressure the night after the event took place (in hectopascals)

sd_nextnight_P : The standard deviation of pressure the night after the event took place (in hectopascals)

night_P_diff : The difference between the mean pressures of the night before and the night after the event took place (in hectopascals)

median_activity : The median activity during that event

sum_activity : The sum of the activity during that event

prop_resting : The propotion of time during that event where activity = 0

prop_active : The propotion of time during that event where activity > 0

mean_night_act : The mean activity during the night before the event took place

sd_night_act : The standard deviation of activity the night before the event took place

sum_night_act : The summed activity during the night before the event took place

mean_nextnight_act :The mean activity the night after the event took place

sd_nextnight_act : The standard deviation of activity the night after the event took place

sum_nextnight_act : The summed activity the night after the event took place

night_act_diff : The difference between the mean activity of the night before and the night after the event took place

median_pitch : The median pitch during that event

sd_pitch : The standard deviation of pitch during that event

median_light : The median light recordings during that event

nightime : Whether or not it was night during the majority of the event (1= night, 0 = day)

median_gX : Median raw acceledation on the x axis during the event

median_gY : Median raw acceledation on the y axis during the event

median_gZ : Median raw acceledation on the z axis during the event

median_mX : Median raw magnetic field on the x axis during the event

median_mY : Median raw magnetic field on the y axis during the event

median_mZ : Median raw magnetic field on the z axis

median_temp : Median temperature during the event (in celsius)

sd_temp : Standard deviation of temperature during the event (in celsius)

cum_temp_change : Cumulative absolute difference in temperature during the event (in celsius)

Examples

#data(hoopoe)
#PAM_data=hoopoe
#twl = GeoLight::twilightCalc(PAM_data$light$date, PAM_data$light$obs,
#                             LightThreshold = 2, ask = FALSE)

#TOclassify = pamPREP(PAM_data,
#                     method= "flap",
#                     twl = twl)

#str(TOclassify)


KiranLDA/PAMLr documentation built on March 6, 2023, 1:40 p.m.