Skip to content
Back to formatted view

Raw Message

Message-ID: <3EB8F170.4720.5D6D02@localhost>
Date: 2003-05-07T09:43:44Z
From: PIKAL Petr
Subject: Sum by categorical variable
In-Reply-To: <6C9A2D9477234140A56E9D1B073B28E901DB5D@gitmanex01.git.generali.ch>

Hi

On 6 May 2003 at 16:53, De Amicis Fabrizio (G.I.T.) wrote:

> 
> Another easy(/stupid) question:
> 
> with the following command
>  j2<-xf1[1:10,"V4"]
> I have 
> 
> > j2
>  [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?
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)


> 
> Thank you 
> 
> 
> >  
> > 
> > ---------------------------------------------------------------
> > Fabrizio De Amicis
> > 
> > IT Department
> > Generali Information Technologies - (GIT)
> > 
> > Centro Galleria 2,
> > Via Cantonale
> > CH - 6928 Manno - Switzerland
> > Tel  +41 91 806 6220
> > Fax +41 91 806 6298
> > E-mail: fabrizio.deamicis at git.generali.ch  
> > 
> > 
> > 
> > 
> **********************************************************************
> ** The information in this email is confidential and may be legally...
> {{dropped}}
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

CheersPetr Pikal
petr.pikal at precheza.cz
p.pik at volny.cz