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

Check column names of dataframes? #276

Closed
etiennebacher opened this issue Sep 28, 2022 · 3 comments
Closed

Check column names of dataframes? #276

etiennebacher opened this issue Sep 28, 2022 · 3 comments
Assignees

Comments

@etiennebacher
Copy link
Member

Should this kind of check be generalized to all other functions for consistency? If so, we could make a helper .check_dataframe_names() (we could also suggest using janitor::clean_names()).

datawizard/R/adjust.R

Lines 78 to 83 in 89e8193

if (!all(colnames(data) == make.names(colnames(data), unique = TRUE))) {
insight::format_warning(
"Bad column names (e.g., with spaces) have been detected which might create issues in many functions.",
"Please fix it (you can run `names(mydata) <- make.names(names(mydata))` for a quick fix)."
)
}

@strengejacke
Copy link
Member

Yes, sounds good! I'd also say that we can both suggest makenames and janitor.

@strengejacke
Copy link
Member

Do we want this for all other functions, or only where really needed?

@etiennebacher
Copy link
Member Author

I guess all data_ functions should have this. Any one of them could be called directly on a dataframe with bad column names and they almost have a select argument.

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

No branches or pull requests

2 participants