My R dataset (migration) looks like this:
date gender UK USA Canada Mexico
1990 M 4.2 6.3 4.0 5.1
1990 F 5.2 4.3 6.0 4.1
1991 M 3.2 5.3 5.0 7.1
1991 F 4.2 5.3 4.0 4.1
1992 M 3.2 3.3 2.0 5.1
1992 F 6.2 6.3 4.0 3.1
What do I want to do?
- I want to create a plot showing the trend line by year of all
countries. - I want to
colorbygender - Facet by
countries
What did I do?
- I produced the following code
ggplot(migration,
aes(date,gender, color=gender)) +
geom_point() +
facet_wrap(UK~USA~Canada~Mexico)
However, it does not work. Please kindly help me solve this?
