Skip to content

Summing up Non-numeric column

6 messages · Jorge Ivan Velez, Bill Venables, zhiji19 +2 more

#
Dear All

If I have the following dataset

V1 V2
x   y
y   x
z   b
a   c
b   j
d   l
c   o

How do I use R command to get the total number of different letter in column
"V1"
column "V1" has 7 different letters.

Thank you
#
?unique 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of zhiji19
Sent: Wednesday, 8 December 2010 2:57 PM
To: r-help at r-project.org
Subject: [R] Summing up Non-numeric column


Dear All

If I have the following dataset

V1 V2
x   y
y   x
z   b
a   c
b   j
d   l
c   o

How do I use R command to get the total number of different letter in column
"V1"
column "V1" has 7 different letters.

Thank you
#
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 :

  
    
#
I think

?table

is what you want.

-- Bert

On Wed, Dec 8, 2010 at 1:19 AM, Ivan Calandra
<ivan.calandra at uni-hamburg.de> wrote: