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

Allow multiple rows input to row_to_names() #542

Merged
merged 15 commits into from
May 23, 2023
Merged

Conversation

matanhakim
Copy link
Contributor

Description

This is mostly useful when it comes to data from Excel spreadsheets, where variable names are spread over multiple rows.
Please note that this is not yet a totally finished PR, as one test still fails and no new tests were built yet.
I would like to receive some feedback regarding this to understand if this is even the right direction, since this is my first PR contribution to an established package.

Changes are mostly around allowing multiple rows input and handling NA's and missing values.
Additionally, a test was removed and some code style changes were made for better readability.

Related Issue

Fixes #536.

@billdenney billdenney marked this pull request as draft May 17, 2023 18:13
Copy link
Collaborator

@billdenney billdenney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you said it's not yet ready to merge, I converted it to a draft PR. I think you're on the right track, though tests make it easier to confirm. I'm about to make some code review comments.

R/row_to_names.R Show resolved Hide resolved
R/row_to_names.R Outdated
}
if (row_number %in% "find_header") {
if (any(row_number %in% "find_header")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better as identical(row_number, "find_header") because having some rows as numbers and one as "find_header" would not be an input we would want to support.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it was changed.

R/row_to_names.R Outdated Show resolved Hide resolved
R/row_to_names.R Outdated Show resolved Hide resolved
Add documentation for `sep` argument
Fine-tune check for using "find_header" argument
Add input tests for `sep` argument
Rewrite name manipulation more efficiently
Handle NA column name to be "NA"
Update `remove_rows_above` to refer to the topmost row
Remove redundant function after using `paste_skip_na()`
@matanhakim matanhakim marked this pull request as ready for review May 19, 2023 15:08
Copy link
Collaborator

@billdenney billdenney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good to me. @sfirke, what do you think?

R/row_to_names.R Outdated Show resolved Hide resolved
tests/testthat/test-row-to-names.R Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 19, 2023

Codecov Report

Merging #542 (f7dfa8a) into main (c3fd147) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #542   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         1177      1182    +5     
=========================================
+ Hits          1177      1182    +5     
Impacted Files Coverage Δ
R/row_to_names.R 100.00% <100.00%> (ø)

@billdenney billdenney merged commit 5a34f00 into sfirke:main May 23, 2023
9 checks passed
@billdenney
Copy link
Collaborator

Merged. Thanks!

@sfirke
Copy link
Owner

sfirke commented May 23, 2023

This looks great! Sorry to miss the @ mention above. Thanks so much @matanhakim for contributing, @billdenney for review, and both for getting it to an excellent place 🙏

@matanhakim
Copy link
Contributor Author

Thank you both for bringing this rich package to the community and facilitating my first PR feature contribution to FOSS in general and to the R community specifically🙏

@billdenney
Copy link
Collaborator

And, @matanhakim, thanks for sticking with it to get the code into janitor!!!

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

Successfully merging this pull request may close these issues.

Feature suggestion: allow multiple rows input to row_to_names()
3 participants