Hi,
Thanks a lot.

here is a fraction of my df:

Sample     Season  Area     Gear  Depth
       1           W           1          5       1
       2           Sp          1          3       1
       2           Sp          1          5       1
       2           Sp          1         11      1
       2           Sp          1         11      1

Sample: 1:28
Season: I, P, V, O
Area: 1:3
Fishing gear: 1:12
Depth: 1:8

each variable level is coded with numbers. e.g I have 3 areas and 12 gears

My doubt:
I'd like to know how many times I saw each gear in the combination of some
of the other factors: e.g. season Sp + area 1 + depth 1.

I've tried to do tables for each pair of variables (with one common
variable) and then a merge but it didn't work.

I'm looking for reshape package but it's not easy to know what to do.


Thanks a lot again.
Cheers,
Barbara




On 14 July 2010 14:39, Dieter Menne <dieter.me...@menne-biomed.de> wrote:

>
>
> barbara horta e costa wrote:
> >
> > I have a data frame with several factors and I want to count the
> > occurrences
> > of an event resulting from an interaction of some factors.
> >
> > I'd only need a table as excel does with pivot table and summarize data
> as
> > count
> >
>
> "Only" what pivot tables does: Pivot tables are one of the best features of
> Excel, and it's not always that easy in R. Hadley Wickham who has written
> the "reshape" package, admitted that he tried to mimic pivot tables in R;
> the fact that the has not been ripped into piece because of this confession
> tells a lot.
>
> Anyway: give package reshape a try; it comes with a nice tutorial. And if
> you have more questions, try to construct a very simple example (3 lines!)
> that runs out of the box and shows your problem. I assume that merge (which
> does something like SQL join) is not what you need, but I am not sure
>
> Dieter
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/count-help-tp2288571p2288764.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
>  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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Bárbara H. Costa
Marine Biologist Researcher
SCIAENA - Marine Sciences and Cooperation
www.sciaena.org

ISPA | http://www.ispa.pt/ui/uie/index.asp
BIOMARES | http://www.ccmar.ualg.pt/biomares/
MSI-UCSB | http://www.msi.ucsb.edu/

bco...@ispa.pt
barbarahco...@gmail.com

        [[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