Sorry if this question has been asked already. I am new to R.
I currently have a dataframe with 1 column. I am trying to build this dataframe with different integers I have.
Apeaks
1
6
5
I have the following integers
Bpeaks = 2 1 6 12 10 5 8
Cpeaks = 2 1
Dpeaks = 4 1 0 9 20 4 18 11 9 6
I am trying to add the integer (list of integers?) Bpeaks to the dataframe Apeaks as a column. At the same time, the Apeaks column would only have 3 values while the Bpeaks column will have 7 values. I am trying to assign the value of 0 for each row of Apeaks for the extra # of rows as Bpeaks.
This is what I'm hoping for my result
Apeaks Bpeaks
1 2
6 1
5 6
0 12
0 10
0 5
0 8
In addition, when I add a column of shorter value, the rows will automatically be assigned as 0. For example
Cpeaks = 2 1
Apeaks Bpeaks Cpeaks
1 2 2
6 1 1
5 6 0
0 12 0
0 10 0
0 5 0
0 8 0
And when I add another column of longer length, all the existing columns add a value of 0 for each extra row. For example
Dpeaks = 4 1 0 9 20 4 18 11 9 6
Apeaks Bpeaks Cpeaks Dpeaks
1 2 2 4
6 1 1 1
5 6 0 0
0 12 0 9
0 10 0 20
0 5 0 4
0 8 0 18
0 0 0 11
0 0 0 9
0 0 0 6
Is there any way to do this (code would be very helpful)? Appreciate the help!