Hi:
A small toy example:
fakedata <- data.frame(group = factor(rep(1:3, each = 10), labels
paste('Therapy', 1:3)),
city = factor(rep(c('Amsterdam',
'Rotterdam'), each = 5)),
pressure = rnorm(30))
with(fakedata, interaction.plot(group, city, pressure, type="b",
col= c(1:2),
leg.bty="o", leg.bg="skyblue", lwd=1,
pch=c(18,24,22),
xlab="Group",
ylab="Pressure",
main="Interaction Plot")
)
HTH,
Dennis
On Mon, Oct 3, 2011 at 5:11 AM, flokke <ingaschwabe at gmail.com>
wrote:> Hi everyone,
> I have the following problem:
>
> I have three variables, 'group', 'city' and
'pressure'
>
> There is an interaction effect between group and city and I'd like to
show
> this in an interaction plot:
>
> interaction.plot(group, city, pressure, type="b",
> ? ? ? ? ? ? ? ? col= c(1:2),
> ? ? ? ? ? ? ? ? leg.bty="o", leg.bg="blue", lwd=1,
pch=c(18,24,22),
> ? ? ? ? ? ? ? ? xlab="Group",
> ? ? ? ? ? ? ? ? ylab="Pressure",
> ? ? ? ? ? ? ? ? main="Interaction Plot")
>
> My problem is that I cant find a proper argument to pass factor names to
the
> variables 'group' and 'city'.
>
> In the interaction plot now the groups are referred to as '1',
'2' and '3'
> and the citys are referred to '1', 2'. Hoewever, Id like to
pass
> string character names to those ('Therapy 1, 'therapy 2 and therapy
3). I'd
> also like to pass
> string character names to the varibale 'city' ('Amsterdam',
"Rotterdam',
> etc.)
>
> I'm a quite new user (since two weeks), and normally I can easily find
the
> solution to my problems on
> the internet, but however this time I'm frustrated because I cant find
> solutions that are helping me.
>
> I'd be very glad if you could give me a hint or could show me how to
deal
> with this problem.
>
> Cheers,
> Maria
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Assigning-factor-names-to-interaction-plot-tp3867311p3867311.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>