Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- breaks counts.x counts.y
- 1 -20 1 1
- 2 -15 0 1
- 3 -10 0 5
- 4 -5 4 18
- 5 0 13 27
- 6 5 18 25
- 7 10 9 12
- 8 15 2 1
- 9 20 1 7
- 10 25 NA 0
- 11 30 NA 1
- d=melt(d,id=breaks)
- Error in varnames[id.vars] :
- only 0's may be mixed with negative subscripts
- library(reshape)
- library(ggplot2)
- d <- data.frame(breaks = c(-20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30),
- counts.x = c(1, 0, 0 ,4 , 13, 18, 9, 2, 1, NA, NA),
- counts.y = c(1, 1, 5, 18, 27, 25, 12, 1, 7 , 0, 1))
- d <- melt(d, id = "breaks")
- ggplot(d, aes(x = breaks, y = value)) + geom_point(aes(colour = variable)) +
- labs(title = "Bins vs. Counts", x = "Bins", y = "Counts") +
- theme(plot.title = element_text(face = "bold"))
- library(tidyr)
- d <- gather(d,"variable","value",2:3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement