[R] Problems with statistics

Mike Lawrence mike at thatmike.com
Thu Jan 22 22:33:16 CET 2009


n.means = with(my.data,aggregate(n_red,list(n=n),mean))

plot(n.means)

On Thu, Jan 22, 2009 at 5:17 PM,  <odif at gmx.de> wrote:
> Hello,
>
> I have the following csv file
>
> n,      n_red
> 1,      0
> 1,      1
> 2,      1
> 2,      1
> 3,      0
> 4,      1
> 4,      2
> 4,      3
>
> I would like to plot this data. On the x-axis there should be n and on the
> y-axis the mean of all n_red where n is the according value on the x-axis.
> The plot should look like plotting the following data:
>
> n,      n_red
> 1,      0.5
> 2,      1
> 3,      0
> 4,      2
>
> Is there any simple way to do this?
>
> Greetings
> odif
>
> ______________________________________________
> 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.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University
www.thatmike.com

Looking to arrange a meeting? Check my public calendar:
http://www.thatmike.com/mikes-public-calendar

~ Certainty is folly... I think. ~




More information about the R-help mailing list