Re: [R] Losing custom attributes

2011-11-23 Thread David Winsemius
On Nov 23, 2011, at 10:19 AM, Smart Guy wrote: Hi Eric, Thanks for the reply. Actually, I am looking for a way so that my custom attributes are not lost after the row insert operation. It can be rbind() or some other way. dfm <- dfm[c(1,1:nrow(dfm), ] dfm[ 1, ] <- c(age=16, weight= 4

Re: [R] Losing custom attributes

2011-11-23 Thread Smart Guy
Hi Eric, Thanks for the reply. Actually, I am looking for a way so that my custom attributes are not lost after the row insert operation. It can be rbind() or some other way. Regards, SG On 23 November 2011 18:07, Eric Lecoutre wrote: > > I guess rbind takes attributes from the first dat

Re: [R] Losing custom attributes

2011-11-23 Thread Eric Lecoutre
I guess rbind takes attributes from the first dataframe. I tried to rbind with mydata[NULL,,drop=FALSE] but rbind help states that empy data frames are dropped from rbind. So that as a workaround, I have: mydata*<-* rbind(mydata[1,,drop=FALSE],newrow, mydata)[-1,] Eric On 23 November 2011 13:2

[R] Losing custom attributes

2011-11-23 Thread Smart Guy
Hi All, I was adding a new row of data to my data frame using rbind(). I was surprised to see that after adding new row, I lost my data frame level attibute as well as col level attribute. Please help me to insert a new row at frist or middle position so that my custom attribute is not