Consider this data structure  (df1) ...
 
      Group Year PctProf FullYr
1  Never RF 2004      87     88
2  Cohort 1 2004      83     84
3  Cohort 2 2004      84     86
4  Cohort 3 2004      87     87
5  Cohort 4 2004      73     74
6  Never RF 2005      85     86
7  Cohort 1 2005      81     82
8  Cohort 2 2005      81     81
9  Cohort 3 2005      78     79
10 Cohort 4 2005      72     74
11 Never RF 2006      83     84
12 Cohort 1 2006      78     78
13 Cohort 2 2006      78     79
14 Cohort 3 2006      70     71
15 Cohort 4 2006      80     82
16 Never RF 2007      82     83
17 Cohort 1 2007      75     76
18 Cohort 2 2007      73     74
19 Cohort 3 2007      79     80
20 Cohort 4 2007      75     77
21 Never RF 2008      83     84
22 Cohort 1 2008      81     81
23 Cohort 2 2008      81     81
24 Cohort 3 2008      76     77
25 Cohort 4 2008      62     63

... which I subsetted to omit all cases for Cohort 4 and some cases for
Cohorts 2 & 3 ...
 
df2 <- subset(df1,
    ((Group == "Cohort 1" | Group == "Never RF") | (Group == "Cohort 2"
& Year != 2004) |
      (Group == "Cohort 3" & Year > 2006)))
 
> df2
      Group Year PctProf FullYr
1  Never RF 2004      87     88
2  Cohort 1 2004      83     84
6  Never RF 2005      85     86
7  Cohort 1 2005      81     82
8  Cohort 2 2005      81     81
11 Never RF 2006      83     84
12 Cohort 1 2006      78     78
13 Cohort 2 2006      78     79
16 Never RF 2007      82     83
17 Cohort 1 2007      75     76
18 Cohort 2 2007      73     74
19 Cohort 3 2007      79     80
21 Never RF 2008      83     84
22 Cohort 1 2008      81     81
23 Cohort 2 2008      81     81
24 Cohort 3 2008      76     77

Now, 
 
> table(df2$Group)
 
... properly shows 0 cases for the Group level "cohort 4" ...
 
Cohort 1 Cohort 2 Cohort 3 Cohort 4 Never RF 
       5        4        2        0        5 

But when I plot ...
 
coll = c("violet","blue","green","red")

with(df2, interaction.plot(Year, Group, FullYr,
     lwd=3,col=coll, bty="l", lty=1, las=1,
     ylab="Percent Proficient", xlab="",
     main = "Proficiency Trends for RF and Non-RF Schools"))
 
...  I get the four lines that I expected but the legend includes the
Group level "cohort 4" .
 
How can I get rid of "cohort 4" in Group?
 
Thanks!
Art

------------------------------------------------------------------

Art Burke
Northwest Regional Educational Laboratory
101 SW Main St, Suite 500
Portland, OR 97204-3213

Phone:  503-275-9592 / 800-547-6339

Fax: 503-275-0450

burkea@nwrel.org 




  


	[[alternative HTML version deleted]]


