jespermaag / gganatogram

Create anatograms using ggplot2
379 stars 52 forks source link

Basic but annoying situation #26

Closed panchoco closed 4 years ago

panchoco commented 4 years ago

Dear all,

The package looks really great. When I copy the exercise the plot looks fantastic. However, when I use my dataset which look like:

'data.frame': 26 obs. of 4 variables: $ organ : chr "adipose_tissue" "adrenal_gland" "brain" "heart" ... $ colour: chr "red" "red" "red" "red" ... $ Gene : chr "Stau1" "Stau1" "Stau1" "Stau1" ... $ value : num 57 117 171 36 35 45 67 121 37 36 ...

And then I try to do any plot, RStudio return this: Error in stats::complete.cases(dat) : no input has determined the number of cases

Do you have an idea of what its happening? It's really frustrating, because as I said, when I do the dummy data.frame that you posted works fantastic.

Thank you in advance,

Best

jespermaag commented 4 years ago

Hi,

The error seem to suggest you have missing values in your data frame. I could replicate the issue when i set one of the organ values to NA ` df_test[df_test$organ == "testis",]$organ <- NA

                 NA   reproductive   #d95f02         NA
              prostate   reproductive   #d95f02 14.1272101

gganatogram(df_test) Error in stats::complete.cases(dat) : no input has determined the number of cases`

panchoco commented 4 years ago

Hi Jasper,

Sadly is not that. I always add na.omit just to be sure. =(

panchoco commented 4 years ago

At the end, I had "ovary" and "testis" in the same data frame. That was the problem.

Thanks