clean_location_data: Cleans a raw animal GPS dataset, implementing a standardized...

Description Usage Arguments Value Examples

View source: R/data_cleaning.R

Description

Cleans a raw animal GPS dataset, implementing a standardized procedure to remove impossible values

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
clean_location_data(
  df,
  dtype,
  prep = TRUE,
  filters = TRUE,
  aniid = NA,
  gpsid = NA,
  maxrate = 84,
  maxcourse = 100,
  maxdist = 840,
  maxtime = 60 * 60,
  tz_in = "UTC",
  tz_out = "UTC"
)

Arguments

df

data frame in standardized format (e.g., from a raw spreadsheet)

dtype

data type, iGotU or Columbus P-1

prep

reformat columns if all required columns are not present, defaults to True

filters

filter bad data points, defaults to true

aniid

identification code for the animal

gpsid

identification code for the GPS device

maxrate

maximum rate of travel (meters/minute) between consecutive points

maxcourse

maximum distance (meters) between consecutive points

maxdist

maximum geographic distance (meters) between consecutive points

maxtime

maximum time (minutes) between consecutive points

tz_in

input time zone, defaults to UTC

tz_out

output time zone, defaults to UTC

Value

data frame of clean animal GPS data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Clean a data frame from csv

## Read igotU data
bannock_df <- read.csv(system.file("extdata", "demo_nov19/Bannock_2017_101_1149.csv", 
package = "animaltracker"), skipNul=TRUE)

## Clean and filter
clean_location_data(bannock_df, dtype = "igotu", filters = TRUE, aniid = 1149, 
gpsid = 101, maxrate = 84, maxdist = 840, maxtime = 100)

## Clean without filtering
clean_location_data(bannock_df, dtype = "igotu", filters = FALSE, aniid = 1149, 
gpsid = 101, maxrate = 84, maxdist = 840, maxtime = 100)

# Clean a data frame from txt

## Read Columbus P-1 data
columbus_df <- read_columbus(system.file("extdata", "demo_columbus.TXT", 
package = "animaltracker"))

## Clean and filter
clean_location_data(columbus_df, dtype = "columbus", filters = TRUE, aniid = 1149, 
gpsid = 101, maxrate = 84, maxdist = 840, maxtime = 100)

mathedjoe/animaltracker documentation built on Aug. 12, 2021, 7:46 a.m.