I am working on a project where I am trying to use ggplot to plot ages versus degrees and income based on age. I am looking to make this a scatter plot. I have tried a number of way to melt, combine, etc this data into a ggplot that works, but I get errors no matter what I do. Here is a sample of my data frame:
age_group hs_grad some_college assoc_degree bach_degree bach_plus
1 ..18 to 24 years 32787 32096 34840 52133 54383
2 ..25 to 34 years 40778 45312 47222 68012 74160
3 ....25 to 29 years 37822 42108 43307 62829 65875
4 ....30 to 34 years 44173 48648 51043 73380 81492
5 ..35 to 44 years 49650 59910 60773 90132 103691
6 ....35 to 39 years 49522 56266 58729 89104 101225
I have tried the following as an example:
data15<-data.frame(x = data14$age_group, y= c(data14$hs_grad, data14$some_college, data14$assoc_degree, data14$bach_degree, data14$bach_plus),
group = c(rep("hs_grad", nrow(data)),
rep("some_college", nrow(data)),
rep("assoc_degree", nrow(data)),
rep("bach_degree", nrow(data)),
rep("bach_plus", nrow(data))))
However, I keep getting errors like the following:
Error in rep("hs_grad", nrow(data)) : invalid 'times' argument