I am trying to combine:
to_graph <- structure(list(Teacher = c("BS", "BS", "FA" ), Level = structure(c(2L, 1L, 1L), .Label = c("BE", "AE", "ME", "EE"), class = "factor"), Count = c(2L, 25L, 28L)), .Names = c("Teacher", "Level", "Count"), row.names = c(NA, 3L), class = "data.frame")
and
graph_avg <- structure(list(Teacher = structure(c(1L, 1L, 2L), .Label = c("BS", "FA"), class = "factor"), Count.Fraction = c(0.0740740740740741, 0.925925925925926, 1)), .Names = c("Teacher", "Count.Fraction" ), row.names = c(NA, -3L), class = "data.frame")
with merge(to_graph, graph_avg, by="Teacher")
, but instead of getting what I expect (3 lines), I get:
Teacher Level Count Count.Fraction 1 BS AE 2 0.07407407 2 BS AE 2 0.92592593 3 BS BE 25 0.07407407 4 BS BE 25 0.92592593 5 FA BE 28 1.00000000
Any ideas? Thanks!