Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fwf_positions() guess end argument from start #996

Closed
rcragun opened this issue May 9, 2019 · 2 comments
Closed

Make fwf_positions() guess end argument from start #996

rcragun opened this issue May 9, 2019 · 2 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@rcragun
Copy link

rcragun commented May 9, 2019

I would expect fwf_positions() to guess the value of end based on the value of start. If end is not specified, the best guess should be that end is lead(start)-1. Perhaps I misunderstand what arg=NULL means, but having end=NULL implies to me that end is optional. I believe that this function could be improved with some simple changes:

fwf_positions <- function (start, end, col_names = NULL) {
  if(missing(end)){
    end <- lead(start)-1L
  }
  col_names <- fwf_col_names(col_names, length(start))
  tibble(begin = start - 1L, end = end, col_names = col_names)
}
@rcragun rcragun changed the title Make fwf_positions guess end argument from start Make fwf_positions() guess end argument from start May 9, 2019
@rcragun rcragun changed the title Make fwf_positions() guess end argument from start Make fwf_positions() guess end argument from start May 9, 2019
@jimhester
Copy link
Collaborator

end = NULL looks like it was inadvertantly added in #616, it should probably just be removed.

@jimhester jimhester added the bug an unexpected problem or unintended behavior label May 13, 2019
@jimhester
Copy link
Collaborator

jimhester commented Sep 21, 2020

Fixed by da99e55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants