hms-dbmi / UpSetR

An R implementation of the UpSet set visualization technique published by Lex, Gehlenborg, et al..
https://cran.rstudio.com/web/packages/UpSetR
Other
764 stars 156 forks source link

provide support for tibbles/csv files read with readr::read_csv #80

Open fmichonneau opened 7 years ago

fmichonneau commented 7 years ago

It would be nice to support directly data frames stored as tibbles. Currently it fails as follows (I got the same error with my own dataset):

> movies <- readr::read_csv2( system.file("extdata", "movies.csv", package = "UpSetR"))
Using ',' as decimal and '.' as grouping mark. Use read_delim() for more control.
Parsed with column specification:
cols(
  .default = col_integer(),
  Name = col_character(),
  AvgRating = col_number()
)
See spec(...) for full column specifications.
> upset(movies)
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
tinyheero commented 7 years ago

+1

Ran into the same issue on my end. Got around by using as.data.frame(), but there shouldn't be any reason why it can't take a tibble directly?

AB-Kent commented 6 years ago

I think this can be fixed by changing line 5 of Helper.funcs.R to column <- data[[i]]

The problem is that tibbles don't automatically convert to a vector when subset to a single column.

You could also use column <- data[, i, drop=TRUE] but that will only work with tibble >= 1.4.1 (see tidyverse/tibble#311)

zx8754 commented 6 years ago

Duplicate of https://github.com/hms-dbmi/UpSetR/issues/71

webbedfeet commented 4 years ago

Looks like this was "solved" two years ago by @mariobecerra but never pulled, so the problem still persists in version 1.4.0

mariobecerra commented 4 years ago

Yes, and I saw several other pull requests that never got attended. You can take a look at my fork and try to use it. I would help you more but I haven't used this in a long time so I don't remember.