[R] Is there way to add a new row to a data frame in a specific location

2011-11-24 Thread Sammy Zee
Is there easy way (without copying the existing rows to a temporary location and copying back) to add a new row to a specific index location in an existing data frame? Example df = data.frame( A= c('a','b','c'), B=c(1,2,3), C=(10,20,30)) newrow = c('X', 100, 200) I want to add the newrow as the

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

2011-11-15 Thread Sammy Zee
issue with this method. > > > > Thanks, > > Sammy > > > > On Sat, Nov 12, 2011 at 10:16 PM, David Winsemius > wrote: > > > > > > > > On Nov 12, 2011, at 6:40 PM, Sammy Zee wrote: > > > > > > Thanks David. Besides rbind(), is there a

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

2011-11-13 Thread Sammy Zee
, David Winsemius wrote: > > 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. Yo

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 rbin

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

2011-11-12 Thread Sammy Zee
- > Jeff NewmillerThe . . Go Live... > DCN:Basics: ##.#. ##.#. Live > Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/BatteriesO.O#. #.O#. with > /Soft

[R] rbind.data.frame drops attributes for factor variables

2011-11-10 Thread Sammy Zee
Hi all, 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. I see the following post with same problem. However i did not see any reply to the following posting offering a solution. Could someone pl