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

Minor speedup opportunity in write_xlsx() #45

Open
sindribaldur opened this issue Feb 12, 2020 · 0 comments
Open

Minor speedup opportunity in write_xlsx() #45

sindribaldur opened this issue Feb 12, 2020 · 0 comments

Comments

@sindribaldur
Copy link

sindribaldur commented Feb 12, 2020

  if(any(nchar(names(x)) > 31)){
    warning("Truncating sheet name(s) to 31 characters")
    names(x) <- substring(names(x), 1, 29)
  }
  nm <- names(x)
  if(length(unique(nm)) <  length(nm)){
    warning("Deduplicating sheet names")
    names(x) <- make.unique(substring(names(x), 1, 28), sep = "_")
  }

Could be changed to:

  nm <- names(x)
  if(any(nchar(nm) > 31)){
    warning("Truncating sheet name(s) to 31 characters")
    names(x) <- substring(nm, 1, 29)
    nm <- names(x)
  }
  if(anyDuplicated(nm) != 0L){
    warning("Deduplicating sheet names")
    names(x) <- make.unique(substring(nm, 1, 28), sep = "_")
  }

but I didn't know how to (nor if I should) submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant