Re: [R] concatenate data frame

From: P Ehlers <ehlers_at_math.ucalgary.ca>
Date: Thu 08 Dec 2005 - 06:44:52 EST

Guillaume,

I assume that 'tab' is a data frame and that, for some unspecified reason, you want to get two subsets of the last column of tab, overlapping one case, and coercing the final result to a data frame. If that is correct, then

as.data.frame(c(tab_tmp, tab_tmp1))

will give you a data frame. Alternatively, check out the 'drop =' argument to '[.data.frame' and then rbind your pieces.

Peter Ehlers

herodote@oreka.com wrote:
> hi all
>
> Here is a small part of my code:
>
> tab_tmp<-tab[1:(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])),length(tab)];
>
> tab_tmp1<-tab[(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])):length(TotalFillTimeHours),length(tab)];
>
> tab<-c(tab_tmp,tab_tmp1);
> attach(tab);
>
> Here is the output:
> Error in attach(tab) : attach only works for lists and data frames
> Execution halted
>
>
> How do i concatenate them in order to keep the data frame structure?
>
>
> thks for your help
> guillaume
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 08 06:53:07 2005

This archive was generated by hypermail 2.1.8 : Thu 08 Dec 2005 - 14:30:30 EST