[R] Help in getting info from a DataFrame
David Winsemius
dwinsemius at comcast.net
Mon Jan 31 00:05:47 CET 2011
On Jan 30, 2011, at 5:27 PM, ADias wrote:
> dados<-
> data
> .frame
> (Store
> =
> c
> ("Setubal
> ","lx
> ","Aveiro
> ","Coimbra
> ","Aveiro","Evora","Aveiro","Coimbra","Setubal"),Prod=c("Bloco
> Desenho","Bloco
> Desenho
> ","Tinteiro
> ","Régua
> ","Lapiseira
> ","Regua
> ","Tinteiro","Lapiseira","Lapiseira"),qtd=c(2,1,2,1,3,1,1,1,1))
See if this is a more useful approach:
> lapsales <- dados[dados$Prod=="Lapiseira", ]
> lapsales[which.max(lapsales[ , "qtd" ]), "Store"]
[1] Aveiro
Levels: Aveiro Coimbra Evora lx Setubal
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list