R/read_logger_folder.R

Defines functions read_logger_folder

Documented in read_logger_folder

#' Read logger files
#'
#' @description read all logger files in folder
#'
#' @author RadioTracking EU
#'
#' @param path directory with the logger files
#'
#' @return data.frame with the raw logger data
#'
#' @export
#'

read_logger_folder <-function(path){

  list_of_stations<-list.dirs(path,full.names = FALSE, recursive =FALSE)
  tmp_data<-NULL

  receivers_count <- 0;
  for(i in list_of_stations){
    receivers_count <- receivers_count + length(list.dirs(file.path(path,i), full.names = FALSE, recursive = FALSE))
  }
  status_read<-0


  for(i in list_of_stations){
    list_of_receivers<-list.dirs(file.path(path,i), full.names = FALSE, recursive = FALSE)
    for (j in list_of_receivers) {

      list_of_records <- list.files(file.path(path,i,j), no..=T)

      for (k in list_of_records) {
        p<-file.path(path,i,j,k)
        print(p)
        data<-read_logger_data(p)
        if(!is.null(data)){
          tmp_data<-rbind(cbind(data, receiver = j, Name = i),tmp_data)
        }
      }
      #incProgress(amount=1)
    }
  }


  return(tmp_data[, c("timestamp", "duration", "signal_freq", "Name", "receiver", "max_signal","signal_bw")])
}
Nature40/UM2Radiotracking documentation built on Aug. 14, 2019, 8:05 a.m.