R/test_data.R

Defines functions read_data

Documented in read_data

#' Read data in csv.
#'
#' @param x the name of the file which the data are to be read from. this
#' is a \code{data.frame} in format csv.
#' @param digits Number of digits are \code{\link{round}ed} to. DEFAULT: 4
#'
#' @return a \code{tibble}
#' @export
#'
#' @seealso Package 'tibble' as 'readr'
#'
#' @examples
#' \dontrun{
#' # Test data
#' csv <- system.file("extdata", "test.csv", package = "GeodesiCL")
#' data_test <- read_data(csv)
#' }
read_data <- function(x, digits = 4){
  values <- readr::read_csv(x)
  values1 <- tibble::as_tibble(data.frame(Pt = unlist(values$Pt),
                                         East = as.character(unlist(
                                           round(values$East, digits))),
                                         North = as.character(unlist(
                                           round(values$North, digits)))))
  return(print(values1))
}
diegoalarc/GeodesiCL documentation built on July 24, 2022, 9:14 p.m.