R/initAnimal.R

Defines functions initAnimal

Documented in initAnimal

#' Init Animal Tracking
#'
#' @description Creates directories and a R list with all the needed rts information for one animal
#'
#'
#' @author Marvin Ludwig
#'
#' @param projroot string, project directory
#' @param animalID sting, label of the tracking animal
#' @param freq num, tracking frequency
#' @param start sting, start of tracking YYYY-MM-DD
#' @param end string, end of tracking YYYY-MM-DD
#' @param rawdata string, path to the full RTS dataset
#'
#' @export
#'
#'




initAnimal = function(projroot = getwd(),
                      animalID,
                      freq,
                      start,
                      end,
                      rawdata
){

  # create project sturture
  dir.create(paste0(projroot, "/", animalID), showWarnings = FALSE)
  dir.create(paste0(projroot, "/", animalID, "/stations"), showWarnings = FALSE)
  dir.create(paste0(projroot, "/", animalID, "/keepalive"), showWarnings = FALSE)
  dir.create(paste0(projroot, "/", animalID, "/filtered"), showWarnings = FALSE)

  # save meta data
  meta = list(animalID = animalID,
                    freq = freq,
                    start = start,
                    end = end)
  # get paths
  path = list(raw = rawdata,
                    root = paste0(projroot, "/", animalID),
                    stations = paste0(projroot, "/", animalID, "/stations"),
                    keepalive = paste0(projroot, "/", animalID, "/keepalive"),
                    filtered = paste0(projroot, "/", animalID, "/filtered"))

  animal = list(meta = meta,
                path = path)

  return(animal)

}
Nature40/Rrt documentation built on March 31, 2020, 12:45 a.m.