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

set_tidy_names fails when wanting syntactic names #260

Closed
imanuelcostigan opened this issue May 23, 2017 · 1 comment · Fixed by #261
Closed

set_tidy_names fails when wanting syntactic names #260

imanuelcostigan opened this issue May 23, 2017 · 1 comment · Fixed by #261

Comments

@imanuelcostigan
Copy link
Contributor

Reprex:

library(tibble)
packageVersion("tibble")
#> [1] '1.3.1'
tbl <- tibble(`a name` = 1, b = 2)
set_tidy_names(tbl, syntactic = TRUE)
#> Error: length(orig_name) == length(name) is not TRUE

Analysis: make_syntactic() is not returning the parsed set of field names. Input name is [1] "a name" "b" while last line of this function is assignment of parsed field names rather than full set of field names and hence returns only subset of field names that have been tidied:

function (name, syntactic) 
{
  if (!syntactic) 
    return(name)
  blank <- name == ""
  fix_syntactic <- (name != "") & !is_syntactic(name)
  name[fix_syntactic] <- make.names(name[fix_syntactic])
}
@imanuelcostigan imanuelcostigan changed the title tidy_names fails when wanting syntactic names set_tidy_names fails when wanting syntactic names May 23, 2017
imanuelcostigan added a commit to imanuelcostigan/tibble that referenced this issue May 23, 2017
krlmlr added a commit that referenced this issue May 23, 2017
- Fix error in `tidy_names(syntactic = TRUE, quiet = FALSE)` if not all names are fixed (#260, @imanuelcostigan).
krlmlr added a commit that referenced this issue May 27, 2017
- Fix error in `tidy_names(syntactic = TRUE, quiet = FALSE)` if not all names are fixed (#260, @imanuelcostigan).
- The column width for non-syntactic columns is computed correctly again (#258).
- The `print.tbl_df()` method is identical to `print.tbl()`, instead of calling `NextMethod()`, to protect against malformed tibbles that inherit from `"tbl_df"` but not `"tbl"`, as created e.g. by `ungroup()` in dplyr 0.5.0 and earlier.
- Remove unused import declaration for assertthat.
krlmlr added a commit that referenced this issue May 27, 2017
- Fix error in `tidy_names(syntactic = TRUE, quiet = FALSE)` if not all names are fixed (#260, @imanuelcostigan).
- The column width for non-syntactic columns is computed correctly again (#258).
- The `print.tbl_df()` method is identical to `print.tbl()`, instead of calling `NextMethod()`, to protect against malformed tibbles that inherit from `"tbl_df"` but not `"tbl"`, as created e.g. by `ungroup()` in dplyr 0.5.0 and earlier.
- Remove unused import declaration for assertthat.
krlmlr added a commit that referenced this issue May 29, 2017
- Added `format()` and `print()` methods for both `tbl` and `tbl_df` classes, to protect against malformed tibbles that inherit from `"tbl_df"` but not `"tbl"`, as created e.g. by `ungroup()` in dplyr 0.5.0 and earlier (#256, #263).
- The column width for non-syntactic columns is computed correctly again (#258).
- Printing a tibble doesn't apply quote escaping to list columns.
- Fix error in `tidy_names(syntactic = TRUE, quiet = FALSE)` if not all names are fixed (#260, @imanuelcostigan).
- Remove unused import declaration for assertthat.
@github-actions
Copy link
Contributor

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant