Re: [R] Add a column to a dataframe based on multiple other column values

2013-06-12 Thread arun
0 #8 33  82 870 100 1490 97 93.0 #9 33   0 871  82 1494 85 55.7 A.K. - Original Message - From: arun To: Tom Oates Cc: R help Sent: Tuesday, June 11, 2013 5:23 PM Subject: Re: [R] Add a column to a dataframe based on multiple other column values HI, May be this helps:

Re: [R] Add a column to a dataframe based on multiple other column values

2013-06-12 Thread Keith S Weintraub
Tom, Here is my solution. Note that I assume the columns are interleaved as you describe below. I'm sure others will have better replies. Note that using dput helps the helpers. # From dput(mdat) mdat<-structure(list(x1 = c(2L, 2L, 2L, 3L, 3L, 30L, 32L, 33L, 33L), y1 = c(100L, 100L, 100L,

Re: [R] Add a column to a dataframe based on multiple other column values

2013-06-11 Thread arun
HI, May be this helps: dat1<- read.table(text=" x1    y1    x2    y2    x3    y3    output 2    100    190    99    1430    79    89 2    100    192    63    1431    75    69 2    100    192    63    1444    51    57 3    0    195    99    1499    50    74.5 3    0    198    98    1500    80    89