Dear all,
I have a data frame that looks like this:
> dat
V1 V2
1 -8 100
2 -6 20.2
3 -1 1.5
4 2 3.00
5 3 78.8
6 5 33.2
7 6 44.5
8 7 5.00
Now I want to fill the V1 column in series (note that it is gapped),
with the corresponding value in V2 as 0.
So in the end we would like to have:
> newdat
V1 V2
1 -8 100
2 -6 20.2
3 -7 0
4 -6 0
5 -5 0
6 -4 0
7 -3 0
8 -2 0
9 -1 1.5
10 0 0
11 1 0
12 2 3.00
13 3 78.8
14 4 0
15 5 33.2
16 6 44.5
17 7 5.00
Is there a way to do it in R?
- Gundala Viswanath
Jakarta - Indonesia
______________________________________________
[email protected] 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.