krassowski / complex-upset

A library for creating complex UpSet plots with ggplot2 geoms
MIT License
469 stars 28 forks source link

! `data` must be uniquely named but has duplicate columns #175

Closed a14578 closed 1 year ago

a14578 commented 1 year ago

Hello,

I'm trying to generate an upset plot, but I seem to be running into an error associated with "duplicate columns". I've added my code, the data set and the error below. Even when I strip back the data into its simplest form, I still seem to get the error. The column names and rows are all unique. If you had any advice please, that would be great.

CODE: library(ggplot2) library(ComplexUpset)

my_data2 <- read.csv("test5.csv", header = TRUE) df2 <- data.frame(my_data2)

gene_list = c("ybtS","tonB")

upset(df2, gene_list, name='gene_list', width_ratio=0.1)

ERROR:

Error in geom_bar(): ! Problem while computing aesthetics. ℹ Error occurred in the 2nd layer. Caused by error in FUN(): ! data must be uniquely named but has duplicate columns Run rlang::last_error() to see where the error occurred.

rlang::last_error() <error/rlang_error> Error in geom_bar(): ! Problem while computing aesthetics. ℹ Error occurred in the 2nd layer. Caused by error in FUN(): ! data must be uniquely named but has duplicate columns

Backtrace:

  1. base (local) <fn>(x)
  2. rlang::abort(message = message)

data: test5.csv

a14578 commented 1 year ago

I think I've sorted it out, changing the name of the variable column from 'id' to 'name' seems to have resolved this