-
Notifications
You must be signed in to change notification settings - Fork 13
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
String_200 #32
base: main
Are you sure you want to change the base?
String_200 #32
Conversation
This file is used to split the variables in a dataframe which has length > 200 into meaningful string variable with SUPP variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL, I added some of initial comments. @madhan0923 can we consider of using S3 methods for diffrent classes?
R/split_var_call.R
Outdated
@@ -0,0 +1,60 @@ | |||
R_SPLIT = function(domain_dataset,max_length_out = 200){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use tidyver styleguid and snake case https://style.tidyverse.org/syntax.html
- Please add roxygen documentation, with examples
- Please add tests cases
- Please add namesacpes:: to all functions calls from tidyverse packages
R/split_var_call.R
Outdated
char_200 = domain_dataset %>% select_if(~ max(nchar(.)) >= max_length_out) | ||
|
||
#string split function | ||
split_var <- function(string,max_length_out = 200) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not keep function inside function.
R/split_var_call.R
Outdated
split_var <- function(string,max_length_out = 200) { | ||
|
||
# Pattern spot | ||
pattern = names(which.max(table(str_extract_all(string, "[:punct:]|[:blank:]")))) %>% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern can be used for split, but it will not work as sep in paste function.
R/split_var_call.R
Outdated
outt <- map(char_200, ~ { | ||
split_list <- map(.x, ~ { | ||
cv <- as.data.frame(split_var(.x, max_length_out)) | ||
names(cv) <- seq_along(cv) | ||
cv | ||
}) | ||
split_df <- bind_rows(split_list) | ||
split_df | ||
}) %>% imap(.,~set_names(.x,.y)) %>% bind_cols() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consider use of tidyr?
@madhan0923 - Can you address the review comments? Also, merge main to this FB and make sure the pipeline is green. |
This file is used to split the variables in a dataframe which has length > 200 into meaningful string variable with SUPP variables
Thank you for your Pull Request! We have developed this task checklist from the
Development Process
Guide
to help with the final steps of the process. Completing the below tasks helps to
ensure our reviewers can maximize their time on your code as well as making sure
the oak codebase remains robust and consistent.
Please check off each taskbox as an acknowledgment that you completed the task
or check off that it is not relevant to your Pull Request. This checklist is
part of the Github Action workflows and the Pull Request will not be merged into
the
devel
branch until you have checked off each task.Request Title (Use Edit button in top-right if you need to update)
tidyverse style guide. Run
styler::style_file()
to style R and Rmd filesconsider realistic data scenarios and edge cases, e.g. empty datasets, errors,
boundary cases etc. - See
Unit Test Guide
fully follow the
deprecation guidance?
and families. Refer to the
categorization of functions to tag appropriate keyword/family.
devtools::document()
so all.Rd
files in theman
folder and theNAMESPACE
file in the project root are updated appropriatelyNEWS.md
if the changes pertain to a user-facing function (i.e. ithas an
@export
tag) or documentation aimed at users (rather than developers)pkgdown::build_site()
and check that all affectedexamples are displayed correctly and that all new functions occur on the "Reference" page.
lintr::lint_package()
R CMD check
locally and address all errors and warnings -devtools::check()