[R] (no subject)

Ista Zahn izahn at psych.rochester.edu
Wed Feb 2 00:00:43 CET 2011


max(dat[dat$condition=="GPR119a", "responce"])
aggregate(dat$responce, by=list(dat$condition), max)

see ?"[" and ?aggregate

-Ista

On Tue, Feb 1, 2011 at 2:05 PM, A. Ramzan <ar562 at cam.ac.uk> wrote:
> Hello
>
> I am trying to find a way to find the max value, for only a subset of a
> dataframe, depending on how the data is grouped for example,
>
> How would I find the maxmium responce, for all the GPR119a condition below:
>
> responce,mouce,condition
> 0.105902,KO,con
> 0.232018561,KO,con
> 0.335008375,KO,con
> 0.387025433,KO,GPR119a
> 0.576769897,KO,GPR119a
> 0.645120419,KO,GPR119a
> 0.2538608,KO,GPR119b
> 0.183061952,KO,GPR119b
> 0.824035587,KO,GPR119b
> 0.399201597,KO,GPR119c
> 0.417006618,KO,GPR119c
> 0.572958834,KO,GPR119c
> 0.229467444,KO,GPR119d
> 0.294089745,KO,GPR119d
> 0.309964445,KO,GPR119d
> 0.30474325,KO,GPR119e
> 0.159374839,KO,GPR119e
> 0.467726848,KO,GPR119e
> 1.01841912,KO,GPR119f
> 0.423028621,KO,GPR119f
> 0.223588597,KO,GPR119f
>
> Thank
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list