[R] Creating Enumerated Variables

Wu Gong wg2f at mtmail.mtsu.edu
Thu Jul 15 18:17:21 CEST 2010


If you only want a count, please try table

text <- "ID Age School Grade
1 10 1 98
2 10 2 97
3 10 1 92
4 11 1 90
5 11 1 80
6 11 2 70
7 10 1 80
8 10 1 79
9 11 2 70"

df <- read.table(textConnection(text),header=T)
table(df[,2:3])

If you want sort the data, try order.

-----
A R learner.
-- 
View this message in context: http://r.789695.n4.nabble.com/Creating-Enumerated-Variables-tp2290262p2290365.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list