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

Error: data must be uniquely named but has duplicate elements #2641

Closed
hadley opened this issue May 21, 2018 · 4 comments
Closed

Error: data must be uniquely named but has duplicate elements #2641

hadley opened this issue May 21, 2018 · 4 comments
Labels
reprex needs a minimal reproducible example
Milestone

Comments

@hadley
Copy link
Member

hadley commented May 21, 2018

We need a simple reprex for this just to double check it's revealing real problems. Looks like ggforce might be simplest?

@hadley hadley added the reprex needs a minimal reproducible example label May 21, 2018
@hadley hadley added this to the v2.3.0 milestone May 21, 2018
@hadley
Copy link
Member Author

hadley commented May 21, 2018

I thought it might be related to using same facet name as aesthetic, but that doesn't appear to be the case:

library(ggplot2)
df <- data.frame(x = 1:3, colour = c("red", "blue", "red"))

ggplot(df, aes(x, x, colour = colour)) + 
  geom_point() + 
  facet_wrap(~ colour)

Created on 2018-05-20 by the reprex package (v0.2.0).

@hadley hadley closed this as completed May 21, 2018
@hadley hadley reopened this May 21, 2018
@karawoo
Copy link
Member

karawoo commented May 21, 2018

Whatever it is it's already fixed in the dev version of ggforce. I looked at svdvis and there they're passing a data frame that has two different columns called group to geom_point(). Here's a reprex:

library("ggplot2")
df <- data.frame(x = 1:3, group = 1:3, group = 1:3)
names(df) <- c("x", "group", "group")

ggplot(df, aes(x, x)) +
  geom_point()
#> Error: `data` must be uniquely named but has duplicate columns

Created on 2018-05-20 by the reprex package (v0.2.0).

In preparing data for plotting sometimes ggplot creates a group column. I have some suspicion that two columns called group got created somehow in the ggforce example, but I haven't been able to reprexify.

@Sultan91
Copy link

The problem still persist, is there any solution?

@lock
Copy link

lock bot commented Mar 20, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Mar 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

3 participants