| hip_fwf_positions {hipread} | R Documentation | 
Specify column-specific options for hipread
Description
Specify column specifications analogous to readr::fwf_positions().
However, unlike in readr, the column type information is specified
alongside the column positions and there are two extra options that
can be specified (trim_ws gives control over trimming whitespace
in character columns, and imp_dec allows for implicit decimals in
double columns).
Usage
hip_fwf_positions(
  start,
  end,
  col_names,
  col_types,
  trim_ws = TRUE,
  imp_dec = 0
)
hip_fwf_widths(widths, col_names, col_types, trim_ws = TRUE, imp_dec = 0)
Arguments
| start,end | A vector integers describing the start and end positions of each field | 
| col_names | A character vector of variable names | 
| col_types | A vector of column types (specified as either "c" or "character" for character, "d" or "double" for double and "i" or "integer" for integer). | 
| trim_ws | A logical vector, indicating whether to trim whitespace
on both sides of character columns (Defaults to  | 
| imp_dec | An integer vector, indicating the number of implicit decimals on a double variable (Defaults to 0, ignored on non-double columns). | 
| widths | A vector of integer widths for each field (assumes that columns are consecutive - that there is no overlap or gap between fields) | 
Value
A data.frame containing the column specifications
Examples
# 3 Columns, specified by position
hip_fwf_positions(
  c(1, 3, 7),
  c(2, 6, 10),
  c("Var1", "Var2", "Var3"),
  c("c", "i", "d")
)
# The same 3 columns, specified by width
hip_fwf_widths(
  c(2, 4, 4),
  c("Var1", "Var2", "Var3"),
  c("c", "i", "d")
)