[R] Data.frame of Different Length

Ogbos Okike giftedlife2014 @ending from gm@il@com
Mon Sep 17 09:17:03 CEST 2018


Dear Contributors,

I have two data frame of different column lengths. I am trying to have them
in one data frame.
Using
A<-d1$date
B<-d2$date
a<-data.table(A )[ , I := .I][data.table(B )[ , I := .I], on = "I"]
I got
1: 2005-01-04  1 2005-01-04
 2: 2005-01-19  2 2005-01-19
 3: 2005-01-22  3 2005-01-22
 4: 2005-02-24  4 2005-02-19
 5: 2005-05-09  5 2005-02-24
 6: 2005-05-16  6 2005-05-09
 7: 2005-06-17  7 2005-05-11
 8: 2005-07-17  8 2005-05-16
 9: 2005-08-07  9 2005-06-13
10: 2005-09-11 10 2005-06-17
11: 2005-09-13 11 2005-06-22
12: 2005-09-15 12 2005-07-18
13:         NA 13 2005-08-03
14:         NA 14 2005-08-07
15:         NA 15 2005-08-10
16:         NA 16 2005-08-25
17:         NA 17 2005-09-13
18:         NA 18 2005-09-15
19:         NA 19 2005-10-13
20:         NA 20 2005-12-15
which is fine.

I have two more problems:
1) how to remove the nos 1 to 20 inserted at the middle of the dates.

2) how to include more columns.

I have about 5 columns of different lengths which I wish to have in one
data frame.

I will remain grateful if assisted.

Best regards
Ogbos

	[[alternative HTML version deleted]]



More information about the R-help mailing list