R/change.fieldnames.ejscreen.csv.R

Defines functions change.fieldnames.ejscreen.csv

Documented in change.fieldnames.ejscreen.csv

#' @title Change colnames of csv file on EJSCREEN FTP site to nicer colnames
#' @description Just a wrapper to help easily change colnames used in csv file on EJSCREEN FTP site
#'   into friendlier, preferred colnames for work in R. Uses \code{\link[analyze.stuff]{change.fieldnames}}
#' @param mynames A character vector of colnames from a data.frame, like names(mydf). No default.
#' @return Returns a character vector of colnames, same length as input parameter
#' @seealso \code{\link{ejscreenformulas}} \code{\link{ejscreen.acs.rename}} \code{\link[analyze.stuff]{change.fieldnames}}
#' @examples
#'  \dontrun{
#'  gdbtable <- ejscreen.download()
#'  names(gdbtable) <- change.fieldnames.ejscreen.csv(names(gdbtable))
#'  }
#' @export
change.fieldnames.ejscreen.csv <- function(mynames) {
  # just wrapper to change colnames in csv file on ejscreen ftp site to preferred colnames for work in R
  analyze.stuff::change.fieldnames(
    mynames,
    oldnames = ejscreenformulas$gdbfieldname, # from data()
    newnames = ejscreenformulas$Rfieldname   # from data()
  )
}
ejanalysis/ejscreen documentation built on Dec. 31, 2019, 11:52 p.m.