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 · 0 comments

Comments

Projects
None yet
1 participant
@imanuelcostigan
Contributor

imanuelcostigan commented May 23, 2017

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 from tidy_names fails when wanting syntactic names to 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 krlmlr closed this in #261 May 23, 2017

krlmlr added a commit that referenced this issue May 23, 2017

Merge pull request #261 from imanuelcostigan/fix-set-tidy-names
- 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

Merge tag 'v1.3.2'
- 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

Merge tag 'v1.3.2'
- 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

Merge tag 'v1.3.3'
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment