[R] count different words in a field

Matevž Pavlič matevz.pavlic at gi-zrmk.si
Tue Nov 2 22:17:35 CET 2010


Nevermind, i think summary() does this ...



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Matevž Pavlič
Sent: Tuesday, November 02, 2010 10:12 PM
To: r-help at r-project.org
Subject: [R] count different words in a field

Hi all, 

 

I started to ask this in the other post, but it is off topis...so here it is again.

 

I have a data.frame (created with the helpof this mail list) that looks like this :

 

'data.frame':   22801 obs. of  15 variables:

$ V1 : chr  "HUMUS" "SLABO" "MALO" "SLABO" ...

$ V2 : chr  "IN" "GRANULIRAN" "PREPEREL" "VEZAN" ...

$ V3 : chr  "HUMUSNA" "PEŠČEN" "MELJAST" ",KONGLOMERAT," ...

$ V4 : chr  "GLINA" "PROD" "PROD" "P0ROZEN," ...

$ V5 : chr  "Z" "DO" "DO" "S" ...

$ V6 : chr  "MALO" "r" "r" "PLASTMI" ...

$ V7 : chr  "PODA," "=" "=" "GFs," ...

$ V8 : chr  "LAHKO" "8Q" "60mm," "SIVORJAV" ...

$ V9 : chr  "GNETNA," "mm," "S" "" ...

$ V10: chr  "RJAVA" "S" "PRODNIKI," "" ...

$ V11: chr  "" "PRODNIKI" "MALO" "" ...

$ V12: chr  "" "DO" "PEŠČEN" "" ...

$ V13: chr  "" "R" "S" "" ...

$ V14: chr  "" "=" "TANKIMI" "" ...

 

Is it possible to count which word occours most often in each field (V1, V2, V3, ...) and which one is the second and so on. Ideally i would like to create a table for each field (V1, V2, V3, ...) with the prevailing word and the number of occurancies  of that word in that field (column) . 

 

Hope that explains it ok...

 

Thank you, m

 

 

 


	[[alternative HTML version deleted]]



More information about the R-help mailing list