load_format: Format data

View source: R/load.R

load_formatR Documentation

Format data

Description

Formats manually loaded data. Not necessary if using any of the helper loading functions (e.g., load_raw(), load_raw_all(), or data_dl().

Usage

load_format(
  r,
  tz = Sys.timezone(),
  tz_disp = NULL,
  dst = FALSE,
  time_format = "ymd HMS",
  verbose = TRUE
)

Arguments

r

Data frame. Data frame to format.

tz

Character. The time zone the date/times are in (should match one of the zones produced by OlsonNames()). Attempts to use user's system timezone, if none supplied. Defaults to UTC if all else fails.

tz_disp

Character. The time zone the date/times should be displayed in (if not the same as tz; should match one of the zones produced by OlsonNames()).

dst

Logical. Whether or not to use Daylight Savings. When set to FALSE timezones are converted to the Etc/GMT+X timezones which do not include DST. (Note this overrides the timezone specification such that a timezone of America/Vancouver, which would normally include DST in the summer, will be transformed to a timezone with the same GMT offset, but not including DST).

time_format

Character. The date/time format of the 'time' column. Defaults to "ymd HMS". Should be in formats usable by the parse_date_time() function from the lubridate package (e.g., "ymd HMS", "mdy HMS", "dmy HMS", etc.).

verbose

Logical. Whether or not to print messages when renaming columns.

Details

Expects at least three named columns in the data: animal_id, logger_id, time. Will rename to all lower case as required. Also handles columns lat and lon (accepts latitude, longitude, and long, but will be renamed to lat and lon).

time should be a character or factor in date/time format , e.g. 2016-09-30 14:00:00. The exact format of the date/time can be supplied using the time_format argument and should represent a format usable by the lubridate::parse_date_time() function from the lubridate package (e.g., "ymd HMS", "mdy HMS", "dmy HMS", etc.). For example, 09/30/16 2:00 pm can be specified by time_format = "mdy HM p".


animalnexus/feedr documentation built on Feb. 2, 2023, 1:12 a.m.