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 lost.
Here is what I did. age<-c(15,20,18) weight<-c(40,42,30) ### creating my data frame #### mydata <- data.frame(age,weight) ### creating data frame level attribute #### attr(mydata,"myattr")<-c("myinfo") ### creating col level attribute for 'age' column ### attr(mydata$age,"mycolattr")<-c("mycolinfo") #### Checking attributes ### attributes(mydata) attributes(mydata$age) ### creating new row ##### newrow <- data.frame(age=16, weight= 42) #### Inserting newrow as first row to my data frame #### mydata<- rbind(newrow, mydata) #### Checking attributes again ### I lost my custom attributes attributes(mydata$age) attributes(mydata) Thanks in advance, -- SG [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.