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

Problem with Numeric Column Names #235

Closed
const-ae opened this issue Jul 3, 2017 · 4 comments
Closed

Problem with Numeric Column Names #235

const-ae opened this issue Jul 3, 2017 · 4 comments

Comments

@const-ae
Copy link

const-ae commented Jul 3, 2017

Hey,

first let me thank you for the great package.

There seems to be a bug if the column names of the data.frame are numerics. In that case not the data, but the column name is plotted.

See the following example

library(tidyverse)
#> Loading tidyverse: ggplot2
#> Loading tidyverse: tibble
#> Loading tidyverse: tidyr
#> Loading tidyverse: readr
#> Loading tidyverse: purrr
#> Loading tidyverse: dplyr
#> Conflicts with tidy packages ----------------------------------------------
#> filter(): dplyr, stats
#> lag():    dplyr, stats

data <- data_frame(ID = rep(1:1000, each = 5), Sample = rep(1:5, 1000), Value = rnorm(5000))

data
#> # A tibble: 5,000 x 3
#>       ID Sample       Value
#>    <int>  <int>       <dbl>
#>  1     1      1 -0.52150046
#>  2     1      2 -0.29003586
#>  3     1      3 -0.02744497
#>  4     1      4  0.10799648
#>  5     1      5  0.66620994
#>  6     2      1  0.82890267
#>  7     2      2  0.41291929
#>  8     2      3  0.59993000
#>  9     2      4 -0.46190682
#> 10     2      5  0.63775896
#> # ... with 4,990 more rows

data %>%
  tidyr::spread(Sample, Value) %>%
  GGally::ggpairs(columns = as.character(1:5))
#> Warning in fix_column_values(data, columns, columnLabels, "columns", "columnLabels"): Data column name is numeric.  Desired behavior may not be as expected.
#> 
#> c('column = 2' = '1''column = 3' = '2''column = 4' = '3''column = 5' = '4''column = 6' = '5')

data %>%
  mutate(Sample = paste0("Rep_", Sample)) %>%
  tidyr::spread(Sample, Value) %>% 
  GGally::ggpairs(columns = paste0("Rep_", as.character(1:5)))

@schloerke
Copy link
Member

I believe the idea was stemming from pre-ggplot2::print versions. I will address this for the next update.

@lepennec
Copy link
Contributor

This is solved using aes_ combined with as.name instead of aes_string. I've made a pull request (#238).

@schloerke
Copy link
Member

Fixed in #238

@schloerke
Copy link
Member

on CRAN 1.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants