Aliases: vroom_fwf fwf_empty fwf_widths fwf_positions fwf_cols
Keywords:
### ** Examples fwf_sample <- vroom_example("fwf-sample.txt") cat(readLines(fwf_sample))
John Smith WA 418-Y11-4111 Mary Hartford CA 319-Z19-4341 Evan Nolan IL 219-532-c301
# You can specify column positions in several ways: # 1. Guess based on position of empty columns vroom_fwf(fwf_sample, fwf_empty(fwf_sample, col_names = c("first", "last", "state", "ssn")))
# A tibble: 3 × 4 first last state ssn <chr> <chr> <chr> <chr> 1 John Smith WA 418-Y11-4111 2 Mary Hartford CA 319-Z19-4341 3 Evan Nolan IL 219-532-c301
# 2. A vector of field widths vroom_fwf(fwf_sample, fwf_widths(c(20, 10, 12), c("name", "state", "ssn")))
# A tibble: 3 × 3 name state ssn <chr> <chr> <chr> 1 John Smith WA 418-Y11-4111 2 Mary Hartford CA 319-Z19-4341 3 Evan Nolan IL 219-532-c301
# 3. Paired vectors of start and end positions vroom_fwf(fwf_sample, fwf_positions(c(1, 30), c(20, 42), c("name", "ssn")))
# A tibble: 3 × 2 name ssn <chr> <chr> 1 John Smith 418-Y11-4111 2 Mary Hartford 319-Z19-4341 3 Evan Nolan 219-532-c301
# 4. Named arguments with start and end positions vroom_fwf(fwf_sample, fwf_cols(name = c(1, 20), ssn = c(30, 42)))
# A tibble: 3 × 2 name ssn <chr> <chr> 1 John Smith 418-Y11-4111 2 Mary Hartford 319-Z19-4341 3 Evan Nolan 219-532-c301
# 5. Named arguments with column widths vroom_fwf(fwf_sample, fwf_cols(name = 20, state = 10, ssn = 12))
# A tibble: 3 × 3 name state ssn <chr> <chr> <chr> 1 John Smith WA 418-Y11-4111 2 Mary Hartford CA 319-Z19-4341 3 Evan Nolan IL 219-532-c301