Error in read_fwf documentation, do I report here?

I believe I have found an error in the read_fwf documentation here https://readr.tidyverse.org/reference/read_fwf.html

I hope this is the place to report it. Please delete if I'm wrong.

The documentation says:

#> # A tibble: 3 x 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
read_fwf(fwf_sample, fwf_positions(c(1, 30), c(10, 42), c("name", "ssn")))
#> Parsed with column specification:
#> cols(
#>   name = col_character(),
#>   ssn = col_character()
#> )

But I believe the eighth line should read:

read_fwf(fwf_sample, fwf_positions(c(1,10), c(30,42), c("name", "ssn")))

Hmm.. perhaps the syntax is this (newbie here):

fwf_positions(c(start1, start2, start3), c(end1, end2, end3))

That's backwards from most statistical programs I've used.

It might have been clearer if the example had included the names of the parameters, instead of assuming you’d remember their positions from the function signature all the way at the top of the page:

fwf_positions(start, end = NULL, col_names = NULL)

so...

read_fwf(fwf_sample, fwf_positions(start = c(1, 30), end = c(10, 42), col_names = c("name", "ssn")))
4 Likes

The best place to flag this issue is on the package's GitHub issues page. You could even improve the function's documentation and make a pull request. Cleaning up documentation is often seen as a great first step toward participating in open source.

For any package, you can see where to report problems using packageDescription("packagename"). One of the fields should be named something like Maintainer or BugReports and have either an email or web address for reporting problems.

1 Like