Skip to content

Sum by categorical variable

4 messages · De Amicis Fabrizio (G.I.T.), PIKAL Petr, Philippe Hupé +1 more

#
Another easy(/stupid) question:

with the following command
 j2<-xf1[1:10,"V4"]
I have
[1] CHROMOLI             LINEAGERMAI          RINALDI              GIUNTIMA
AUTOSTELLA          
 [6] CAIZZONE             CENTRO B PEL E C SNC CONSORZI             MAN NORD
PDM                 
1304 Levels:   MACHIAVELLI Snc  MENARINI MANUFACTURERS LOGISTICS SERVICES
... ZUCCHERIFICIO DEL MOLISE

  
Why j2 has 1304 Levels (I know that xf has 1304 rows)? How can I obtain a
vector of 10 elements?

Thank you
************************************************************************
The information in this email is confidential and may be legally... {{dropped}}
#
Hi
On 6 May 2003 at 16:53, De Amicis Fabrizio (G.I.T.) wrote:

            
You actually have got first 10 elements of variable "V4" in j2 

see length(j2), 

but as it is a factor the level attribute has retained an information 
about all different levels of "V4" which I presume is 1304. To get 
rid of these levels just use

factor(j2)
CheersPetr Pikal
petr.pikal at precheza.cz
p.pik at volny.cz
#
Hi,

I would like to perform hierachical clustering on data which already 
represents clusters means. The cluster procedure of SAS software can 
take into account this information through the RMSSTD option.  Does 
anyone know a R function which can take into account the frequency of 
each cluster and its standard-deviation.

Thanks

Philippe.
#
Hello,

Because j2 is interpreted as a factor.
To get your vector of just 10 elements use as.vector(j2).

Regards,
Carlos.


-----Mensaje original-----
De: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] En nombre de De Amicis
Fabrizio (G.I.T.)
Enviado el: martes, 06 de mayo de 2003 16:54
Para: 'r-help at lists.R-project.org'
Asunto: [R] FW: Sum by categorical variable



Another easy(/stupid) question:

with the following command
 j2<-xf1[1:10,"V4"]
I have
[1] CHROMOLI             LINEAGERMAI          RINALDI
GIUNTIMA
AUTOSTELLA          
 [6] CAIZZONE             CENTRO B PEL E C SNC CONSORZI             MAN
NORD
PDM                 
1304 Levels:   MACHIAVELLI Snc  MENARINI MANUFACTURERS LOGISTICS
SERVICES
... ZUCCHERIFICIO DEL MOLISE

  
Why j2 has 1304 Levels (I know that xf has 1304 rows)? How can I obtain
a vector of 10 elements?

Thank you
************************************************************************
The information in this email is confidential and may be legally... {{dropped}}