r - Unique value combinations with summary count -


say have following data

x <- (c(1,2,1,1,1,2,2,1,2,1,2)) y <- (c(3,4,4,4,4,3,3,4,4,3,3)) table <- data.frame(x,y) 

how 1 calculate frequencies of unique combinations, ie 1-4

i have looked summary((table$x)[1] & (table$y)[2])

does involve using the unique , length commands? or must use plyr package , use ddply

thanks in advance !

as ananda suggets function table way go:

> df <- data.frame(x, y) > table(df)    y x   3 4   1 2 4   2 3 2 > table(with(df, paste(x, y, sep="-")))  1-3 1-4 2-3 2-4    2   4   3   2  

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -