[R] Adding columns to dataframe

2008-05-15 Thread Bert Jacobs
Hi, I have a dataframe SDF1 that looks like this: Char1 Char2 Char 3 W.2007.02 W.2007.09 W.2007.16 W.2008.13 AC1F1 F2 F3 AC2 F4 BC3 F5 F6 I have another dataframe

Re: [R] Adding columns to dataframe

2008-05-15 Thread Bert Jacobs
PROTECTED] Sent: 15 May 2008 18:12 To: Bert Jacobs Subject: Re: [R] Adding columns to dataframe Will somethink like this work to just add dummy columns: x - data.frame(a=1:10, b=1:10) y - data.frame(a=1, c=1, d=1, e=1, f=1) # get unique names in y uniq - setdiff(names(y), names(x)) # add

Re: [R] Adding columns to dataframe

2008-05-15 Thread jim holtman
for the effort. Bert -- *From:* jim holtman [mailto:[EMAIL PROTECTED] *Sent:* 15 May 2008 18:12 *To:* Bert Jacobs *Subject:* Re: [R] Adding columns to dataframe Will somethink like this work to just add dummy columns: x - data.frame(a=1:10, b=1:10) y

Re: [R] Adding columns to dataframe

2008-05-15 Thread Bert Jacobs
: [R] Adding columns to dataframe Will somethink like this work to just add dummy columns: x - data.frame(a=1:10, b=1:10) y - data.frame(a=1, c=1, d=1, e=1, f=1) # get unique names in y uniq - setdiff(names(y), names(x)) # add dummy columns to x x[uniq] - 0 x a b c d e f 1 1 1 0