Skip to contents

read_header_genesis reads the header of a GENESIS csv.

Usage

read_header_genesis(
  ...,
  start,
  lines = 2,
  readr_locale = locale(encoding = "windows-1252"),
  replacer = NULL,
  clean_letters = TRUE
)

Arguments

...

arguments to read_csv2

start

number of the first line of the header

lines

number of header lines

readr_locale

definition of locale() to be passed to read_csv2()

replacer

a vector that is used as the first K column-names

clean_letters

make proper variable names? (default: TRUE)

locale

default encoding is 'windows-1252'

Value

a vector of column names.

Details

To generate valid column names, the function replaces all special characters (e.g. German öüä) with ASCII letters and removes whitespaces. Multi-line headers are joined but separated with a '_'.

See also

Examples

 if (FALSE) {
  
 library(readr)
 
 download_csv(tablename="12411-0004")
 
 d <- read_header_genesis('12411-0004.csv', start=6, replacer=c("STAG"))
 data <- read_csv2('12411-0004.csv', skip=6, n_max=30-6+1, 
    na="-", locale=locale(encoding="windows-1252") )
 colnames(data) <- d
  }