Re: [R] Creating a table

2006-11-14 Thread Peter Alspach
dmargins(table(loc, V3))) Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Michael Graber > Sent: Wednesday, 15 November 2006 9:21 a.m. > To: R-Mailingliste > Subject: [R] Creating a table > > Dear R List, > > I a

Re: [R] Creating a table

2006-11-14 Thread Benilton Carvalho
tb = table(df$loc, cut(df$year, seq(1970, 1985, by=5), right=F)) rs = rowSums(tb) tb = cbind(tb, rs) cs = colSums(tb) tb = rbind(tb, cs) cheers, b On Nov 14, 2006, at 3:20 PM, Michael Graber wrote: > Dear R List, > > I am a new to R, so my question may be easy to answer for you: > > I have a da

Re: [R] Creating a table

2006-11-14 Thread David Barron
addmargins(table(df)) On 14/11/06, Michael Graber <[EMAIL PROTECTED]> wrote: > Dear R List, > > I am a new to R, so my question may be easy to answer for you: > > I have a dataframe, for example: > > df<-data.frame(loc=c("A","B","A","A","A"), > year=as.numeric(c("1970","1970","1970","1976","1980"

[R] Creating a table

2006-11-14 Thread Michael Graber
Dear R List, I am a new to R, so my question may be easy to answer for you: I have a dataframe, for example: df<-data.frame(loc=c("A","B","A","A","A"), year=as.numeric(c("1970","1970","1970","1976","1980"))) and I want to create the following table without using loops: 1970-74 ; 1975-7