Re: [R] Data.frame Question

2010-03-11 Thread Henrique Dallazuanna
Try this: sweep(DF, 2, 1:2, '+') On Thu, Mar 11, 2010 at 9:20 AM, GULATI, BRIJESH (Global Markets FF&O NY) wrote: > > >>       Hi: >>               I want to add a constant to an existing col of the >> data.frame. I have the following dataset: >> >> >>       structure(list(x = c(1, 1, 1, 1, 1),

Re: [R] data.frame question

2010-03-07 Thread Stephan Kolassa
Hi, data.frame(x=x,y=as.numeric(x%in%y)) HTH, Stephan joseph schrieb: hello can you show me how to create a data.frame from two factors x and y. column 1 should be equal to x and column 2 is 1 if it is common to y and 0 if it is not. x=factor(c("A","B","C","D","E","F","G")) y=factor(c("B",

Re: [R] data.frame question

2010-03-07 Thread baptiste auguie
Hi, try this, data.frame(x,as.numeric(x %in% y)) HTH, baptiste On 7 March 2010 21:06, joseph wrote: > hello > > can you show me how to create a data.frame from two factors x and y. column 1 > should be equal to x and column 2 is 1 if it is common to y and 0 if it is > not. > > x=factor(c("A