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

Open
etiennebacher opened this issue Sep 28, 2022 · 1 comment
Open

Check column names of dataframes? #276

etiennebacher opened this issue Sep 28, 2022 · 1 comment

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.

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