Skip to content

Base scale not working with tibble #762

@TiberiusGracchus2020

Description

@TiberiusGracchus2020

Applying base scale to multiple columns in a tibble results in an incorrectly scaled output and breaks the tibble on sort. Fresh windows, fresh and latest R/RStudio, latest tidyverse.

library(tibble)
iris <- as_tibble(iris)
iris[1:3] <- scale(iris[1:3])
head(iris)
#> # A tibble: 6 x 5
#>   Sepal.Length[,"~ [,"Sepal.Width"] [,"Petal.Length~ Sepal.Width[,"S~
#>              <dbl>            <dbl>            <dbl>            <dbl>
#> 1           -0.898           1.02              -1.34           -0.898
#> 2           -1.14           -0.132             -1.34           -1.14 
#> 3           -1.38            0.327             -1.39           -1.38 
#> 4           -1.50            0.0979            -1.28           -1.50 
#> 5           -1.02            1.25              -1.34           -1.02 
#> 6           -0.535           1.93              -1.17           -0.535
#> # ... with 7 more variables: [,"Sepal.Width"] <dbl>, [,"Petal.Length"] <dbl>,
#> #   Petal.Length[,"Sepal.Length"] <dbl>, [,"Sepal.Width"] <dbl>,
#> #   [,"Petal.Length"] <dbl>, Petal.Width <dbl>, Species <fct>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions