Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-15 Thread Sammy Zee
Thanks. Yes, I meant nrow(dataset)+1 (typo...) Sammy On Mon, Nov 14, 2011 at 1:29 AM, Petr PIKAL wrote: > > > > dataset[ nrow(dataset), ] <- c ("Male", 5, "bad") > > > > The above seems to have worked to append a row in place of a rbind(). > This > > No. It overwrites your last row. You maybe m

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-13 Thread Petr PIKAL
> > dataset[ nrow(dataset), ] <- c ("Male", 5, "bad") > > The above seems to have worked to append a row in place of a rbind(). This No. It overwrites your last row. You maybe meant dataset[ nrow(dataset)+1, ] <- c ("Male", 5, "bad") Regards Petr > method does not drop the custom attributes

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-13 Thread David Winsemius
On Nov 13, 2011, at 11:28 AM, Sammy Zee wrote: dataset[ nrow(dataset), ] <- c ("Male", 5, "bad") The above seems to have worked to append a row in place of a rbind(). This method does not drop the custom attributes from the column. Do yo see any issue with this method. Only that it wipes

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-13 Thread Sammy Zee
dataset[ nrow(dataset), ] <- c ("Male", 5, "bad") The above seems to have worked to append a row in place of a rbind(). This method does not drop the custom attributes from the column. Do yo see any issue with this method. Thanks, Sammy On Sat, Nov 12, 2011 at 10:16 PM, David Winsemius wrote: >

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-12 Thread David Winsemius
On Nov 12, 2011, at 6:40 PM, Sammy Zee wrote: Thanks David. Besides rbind(), is there any other way to add a row to a data frame so that I do not lose the custom attributes. I have already told you the method that I know of. You don't seem to have taken my poin that it is not a data.frame

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-12 Thread Sammy Zee
Thanks David. Besides rbind(), is there any other way to add a row to a data frame so that I do not lose the custom attributes. Thanks, Sammy On Sat, Nov 12, 2011 at 5:17 PM, David Winsemius wrote: > > On Nov 12, 2011, at 2:47 PM, Sammy Zee wrote: > > When I use rbind() or rbind.data.frame() to

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-12 Thread David Winsemius
On Nov 12, 2011, at 2:47 PM, Sammy Zee wrote: When I use rbind() or rbind.data.frame() to add a row to an existing dataframe, it appears that attributes for the column of type "factor" are dropped. See the sample example below to reproduce the problem. Please suggest How I can fix this.

[R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-12 Thread Sammy Zee
When I use rbind() or rbind.data.frame() to add a row to an existing dataframe, it appears that attributes for the column of type "factor" are dropped. See the sample example below to reproduce the problem. Please suggest How I can fix this. Thanks, Sammy a=c("Male", "Male", "Female", "Male") b=c