Skip to content

set_tidy_names fails when wanting syntactic names #260

Description

@imanuelcostigan

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])
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions