thomasp85 / particles

A particle simulation engine based on a port of d3-force
Other
118 stars 9 forks source link

Error: `data` must be uniquely named but has duplicate columns #5

Closed ncchung closed 1 year ago

ncchung commented 6 years ago

When I try to run examples presented in this README or its vignette, I get the following error.

Error: data must be uniquely named but has duplicate columns

R version 3.3.3, with latest particles, ggraph, and so on.

Atrebas commented 5 years ago

I've just encountered the same error in a different context. May be related to ggplot2 or rlang. This is due to duplicated colnames.

jsan4christ commented 5 years ago

Dropping the duplicate column fixed this issue for me

simonlee184 commented 5 years ago

The issue isn't with the R version, but the ggplot2 version. install ggplot2 version 2.2.1 and it should work! require(devtools) install_version("ggplot2", version = "2.2.1", repos = "http://cran.us.r-project.org")

dtsallos commented 5 years ago

Error persists. Is there an update on that?

Using an older version is only a temporary solution which might be limiting in some ways.

thomasp85 commented 5 years ago

haven't had time to look into it, but @jsan4christ's solution is generally applicable...

dtsallos commented 5 years ago

Well, I have only unique values on my data set and I want to compare the distribution of 2 classes of data (only using aes(x,y, fill= category) ) in geom_boxplot or geom_dotplot with code that works in version 2.2.1 as suggested by @simonlee184. Although, if I try using facets then it won't work. Maybe other issues arise when installing the older version. I need to look into those now too.

In the newer version it tells me that there are duplicates when there aren't any. I checked it using all sorts of commands and removing any possible duplicate.

thomasp85 commented 5 years ago

It is difficult to help without a reproducible example. In general it is complaining about duplicate column names, not duplicate values

dtsallos commented 5 years ago

A few things were corrupt in the process of trying to find out what was wrong. Got it all fixed now. Your suggestion to works, just renamed columns this time. Sorry for bothering.

deepakag5 commented 5 years ago

You can use below code which should resolve the issue. colnames(data) <- make.unique(names(data))

canerferhatoglu commented 4 years ago

@iamdeepaka, belive me man, you`re the man! After four hours of struggle, I fixed the problem using your suggestions.

lenabrandt commented 4 years ago

@iamdeepaka thank you so much! this solution saved me hours of search

val23n commented 3 years ago

@iamdeepaka I tried your code suggestion, and I was wondering if you had any thoughts about how to approach this error:

> colnames(cds) <- make.unique(names(cds))
Error in make.unique(names(cds)) : 'names' must be a character vector

Since "cds" is a cell_data_set, I wonder if you have to approach making unique names a different way. Thanks in advance!

7117summer commented 3 years ago

@iamdeepaka I tried your code suggestion, and I was wondering if you had any thoughts about how to approach this error:

> colnames(cds) <- make.unique(names(cds))
Error in make.unique(names(cds)) : 'names' must be a character vector

same question Since "cds" is a cell_data_set, I wonder if you have to approach making unique names a different way. Thanks in advance!