Very simple. And great.
Thanks.

2013/1/3 Sarah Goslee <sarah.gos...@gmail.com>

> sum(test == 0)
>
> On Thu, Jan 3, 2013 at 5:49 PM, Hermann Norpois <hnorp...@googlemail.com>
> wrote:
> > Hello,
> >
> > I wish to count how often zero (0) appears in the vector test.
> >
> > test
> >  [1] 1 1 1 1 1 1 2 1 1 1 0 2 0 1 1 0 0 0 1 1 1 0 1 2 1 1 1 1 1 1
> >
> >
> > I think of something like ...
> >
> >> sapply (test, function (x) if (x==0 ...
> >
> > ... but actually I dont know how to carry on.
> >
> > Could anybody give me a hint?
> >
> > Thanks Hermann
> >
>
> ---
> Sarah Goslee
> http://www.functionaldiversity.org
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to