build 2 graphs separated by levels of an IV?

smir

New Member
#1
Hello there!

I'm trying to make a graph in R: it should be a lineplot with SE bars; x-axis there are 5 treatment levels, y-axis the continuous DV. Also, the data should be separated by years (which I managed to do) but also an additional IV grouping variable (let's call it Q). I think it's best if I do a graph for each grouping variable Q.
Here's my code for the first graph, but I can't figure out who to say it should take one half of the data in one graph, the other in the second. (So Q has 2 levels, 1 and 2).

lineplot.CI(x.factor = treat, response = DV, group=year, data = d.sc, ci.fun= function(x) c(mean(x)-2*se(x), mean(x)+2*se(x)))

Any ideas? :cool:
thanks in advance!
 

Dason

Ambassador to the humans
#2
It's been a while since I've made a decent graph but everything you want to do can be done quite easily (...once you know the syntax) using the ggplot2 package. Hadley's website is a decent place to start learning...
 

smir

New Member
#3
Thanks, that's a great website!
Couldn't find anything on the quick look though.

But I know where I'm stuck: I just want do define one group; something like Q ==1?? But it doesn't work...
 

Dason

Ambassador to the humans
#4
What do you mean you want to define one group?

Do you want to create a dataset that only has that group of interest in it?
 

smir

New Member
#5
I still need the other group for further analyses, so creating a new dataset is probably not the best option.

Can't you say: Take only those values which have level 1 and use them for the graph?