0

I have made two table with the following code:

load(url("http://bit.ly/dasi_gss_data"))
pres<-table(gss$year,gss$confed)
emp<-table(gss$year,gss$joblose)

I am trying to now combine these two tables and keep all rows and columns in which the year is greater than 1987. I have tried the merge function, but keep getting an error. Any suggestions? I would like to keep all the columns from the two tables grouped as they are by year. Thank you!

2 Answers2

0

Do you want something like this:

library(dplyr)

gss %>%
  group_by(year, confed, joblose) %>%
  summarize(n = n())
bramtayl
  • 4,004
  • 2
  • 11
  • 18
0

eventually first do

df.pres <- as.data.frame(unclass(pres))
df.emp <- as.data.frame(unclass(emp))

and then rename columns, merge() and subset()

jogo
  • 12,469
  • 11
  • 37
  • 42