0

I have a table with export of every EU country:

country 2001  2002  2003  .....
france  12023 54554 251515 ....
.....

I would like to do a plot with the value of every years for 4 country (e.g. Germany, Italy, France, Netherlands). It's a dataframe I have tried with those commands:

y<-ts(EXEU)
y
plot(y[5,],type="o")

But when I use ts I lose all the name of the countries and I have on the x-axis frequency not every years. It's possible to do the same without use ts().

1 Answer 1

1

Try this:

library(reshape2)
library(ggplot2)

#EXEU is your dataframe
EXEU<-melt(EXEU,id='country',variable.name='YEAR',value.name='VALUE')
ggplot(EXEU,aes(YEAR,VALUE,group=country, color=country))+geom_line()

Picture example

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.