barbara horta e costa wrote: > > > 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 > >
Here is an example how to create a data frame. If you post again, it is polite and you will get faster answers when you supply sample data in this form. Dieter n = 100 set.seed(123) d = data.frame(Sample = sample(1:28,n,TRUE), Season=sample(c("I","P","V","O"),n,TRUE), Area = sample(c(1:3,NA),n,TRUE), Gear = sample(c(1:12,NA),n,TRUE), Depth = sample(1:8,n,TRUE)) # The real job is rather simple in your case (package reshape is for the hard work) xt = xtabs(d,exclude=NULL,na.action=na.pass) xt ftable(xt, exclude=NULL,na.action=na.pass) -- View this message in context: http://r.789695.n4.nabble.com/count-help-tp2288571p2289161.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 and provide commented, minimal, self-contained, reproducible code.