[R] How can I merge data with differing length?

Michael Dewey info at aghmed.fsnet.co.uk
Thu Oct 30 17:45:33 CET 2014



On 30/10/2014 16:03, Kuma Raj wrote:
> How can I merge  data frame df and "tem" shown below by filling the
> head of "tem"  with missing values?
does

c(rep(NA, nrow(df) - length(tem)), tem)

help?

>
>
> a<- rnorm(1825, 20)
> b<- rnorm(1825, 30)
> date<-seq(as.Date("2000/1/1"), by = "day", length.out = 1825)
>
> df<-data.frame(date,a,b)
>
>
> tem<- rpois(1095,  lambda=21)
>
> Thanks
>
> ______________________________________________
> R-help at 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.
>

-- 
Michael
http://www.dewey.myzen.co.uk



More information about the R-help mailing list