Hi,
Still another way would be to count the levels of the factors (if it is
indeed a factor):
length(levels(example$V1))
Ivan
Le 12/8/2010 06:08, Jorge Ivan Velez a ?crit :
example<- read.table(textConnection("V1 V2
+ x ? y
+ y ? x
+ z ? b
+ a ? c
+ b ? j
+ d ? l
+ c ? o"), header = TRUE)
closeAllConnections()
example
? V1 V2
1 ?x ?y
2 ?y ?x
3 ?z ?b
4 ?a ?c
5 ?b ?j
6 ?d ?l
7 ?c ?o
with(example, length(unique(V1)))
with(example, length(unique(V2)))
[1] 7
HTH,
Jorge
On Tue, Dec 7, 2010 at 11:56 PM, zhiji19<> ?wrote: