Re: [R] Label rows of table by factor level for groups of factors

2012-03-06 Thread Sarah Goslee
06 March 2012 18:27 > To: O'Hanlon, Simon J; r-help > Subject: Re: [R] Label rows of table by factor level for groups of factors > > Well, if you can get this to run your version of R is markedly\ > different than mine. > >> #Start of code >> >> x1=c(rep(0:1,6)

Re: [R] Label rows of table by factor level for groups of factors

2012-03-06 Thread Sarah Goslee
t; > Simon O'Hanlon, BSc MSc > Department of Infectious Disease Epidemiology > Imperial College London > St. Mary's Hospital > London > W2 1PG > > From: Sarah Goslee [sarah.gos...@gmail.com] >

Re: [R] Label rows of table by factor level for groups of factors

2012-03-06 Thread Sarah Goslee
One possible approach is to use unique() to get the list of distinct combinations, cbind() an identifying variable to that list, then use merge() to join it to your existing data frame. But I'm not seeing how you are getting four unique combinations. Given your sample data (with the missing comma

[R] Label rows of table by factor level for groups of factors

2012-03-06 Thread O'Hanlon, Simon J
Dear useRs, I am sure this is a fairly simple problem, but I just cannot get my head around it. I have a dataframe which contains several factor variables. I can use table() to tell me how many different combinations there are of these variables. What I should like to do is to add a column to