R/loadDatasets.R

Defines functions loadDatasets

Documented in loadDatasets

#' @title Load datasets from folder
#' @description Loads all dataset from folder
#' @param format file format to load; rds or rdata
#' @author Jani Miettinen <[email protected]>
#' @rdname loadDatasets
#'

# NOT TESTED!!!
# function which loads all datasets from folder
# currently works with rds and rdata files

loadDatasets <- function(folder, format = "rds"){

  format <- paste0(".", format)

  for(aineisto in list.files(folder, full.names = TRUE, pattern = format)){
    # print(aineisto)
    d <- read_rds(aineisto)
    assign(gsub(fomat, "", gsub( ".*//", "", aineisto)), d)
    rm(d)
  }



}
janikmiet/bricks documentation built on Jan. 31, 2018, 11:54 a.m.