Hi
r-help-bounces at r-project.org napsal dne 02.02.2011 11:14:18:
Hi
r-help-bounces at r-project.org napsal dne 31.01.2011 15:51:16:
<snip>
Hi
thanks. I am not sure if I have understood 100% but at least I know
now
that
there's a diference.
About this:
lapsales
Store Prod qtd
5 Aveiro Lapiseira 3
8 Coimbra Lapiseira 1
9 Setubal Lapiseira 1
> lapsales[max(lapsales$qtd),"Store"]
[1] Setubal
Levels: Aveiro Coimbra Evora lx Setubal
why Setubal and not Aveiro?
Can you explain me the result?
Sorry I did not look to your code and used the code I sent you as a
solution
What do you expect max(lapsales$qtg) give you as a result?
If you changed the number qtd to 4 instead of 3 you will get
lapsales[max(lapsales$qtd),"Store"]
[1] <NA>
Levels: Aveiro Coimbra Evora lx Setubal
So R give you what you ask for. You asked for third line and you got it.
If you asked for which position is the maximum number
lapsales[which.max(lapsales$qtd),"Store"]
[1] Aveiro
Levels: Aveiro Coimbra Evora lx Setubal
You will get desired result.
Regards
Petr