I have been looking a long time to solve what I think is a simple and basic problem: creating a suitable plot for my data.
My dataset consists of several variables (int and num --> columns) for several countries (factorial --> rows). In addition, this this is repeated for 3 years (groups --> also a column repeating itself for every country).
Creating boxplots for 1 variable is easy: boxplot(log(variable)~year, data=df)
(no layout is necessary here).
However, I would like to create 2 different plots:
a graph similar to following plot but with lines that follow each point over the 3 years (like plotting the data of 1 country and connecting the points, but for all countries combined in 1 plot) I wish I could add a graph to make my request clearer.
with(plot(log(variable)~year, type="p"), data=df
A plot where the means of different variables are connected in different colours over the 3 years. So in a way similar to the previous graph but then instead of several countries and 1 variable, the mean of all the countries and several variables.
I hope this request is clear; since this is my first post I might have skipped some essential information. I wished I could add a picture but I can't do that yet.
(edit) My dataset basically looks like this:
structure(list(pooled.Country = structure(1:6, .Label = c("Angola",
"Angola", "Angola", "Cameroon", "Cameroon", "Cameroon",
"Chad"), class = "factor"), Forest = c(59728000L, 2675000L,
12535000L, 6914000L, 22345000L, 22903000L), Pop = c(13138265L,
6154708L, 1695587L, 11621159L, 14976200L, 3559604L), year = c(1998L,
2002, 2006L, 1998L, 2002L, 2006L)), .Names = c("Country",
"Forest", "Pop", "year"), row.names = c(NA,
6L), class = "data.frame")
All help is very much welcomed (also on how to make potential future posts more clear).
Louis