[R] vertically concatenating data frames

John Kane jrkrideau at yahoo.ca
Tue Jul 3 21:07:46 CEST 2007


?rbind


--- "Aydemir, Zava (FID)"
<Zava.Aydemir at morganstanley.com> wrote:

> Hi,
>  
> what is the recommended way to vertically
> concatenate 2 data frames with
> the same column names but different number of rows?
>  
> My problem is something along these lines:
>  
> df1 <- data.frame(var1=var1,var2=var2,var3=var3)  #
> nrow(df1)=1000
> df2 <- data.frame(var1=var4,var2=var5,var3=var6)  #
> nrow(df2)=2000
>  
> I tried df <- c(df1,df2), no success. stack does not
> seem to be
> appropriate either for my problem.
>  
>  
> Thanks
>  
> Zava
>
--------------------------------------------------------
> 
> This is not an offer (or solicitation of an offer)
> to buy/se...{{dropped}}
> 
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list