On Mon, 5 Jul 2010, Moohwan Kim wrote:
Dear R family,
Suppose I have two series.
order value
1 0.52
2 0.23
3 0.43
4 0.21
5 0.32
6 0.32
7 0.32
8 0.32
9 0.32
10 0.12
11 0.46
12 0.09
13 0.32
14 0.25
For these two series, I figured out the way to detect the locations of
duplicate values.
You _asked how_ to do it on R-help and got several answers showing how to
do it.
That doesn't count as 'figured out how to do it'. You should give credit
where it is warranted.
The next thing to do is remove the repeated values except for a value
that would not be next to each other.
Well, that is what you should have asked in the first place.
The answer is actually simpler and need not involve duplicated().
Use one each of these operations
head
tail
!=
c
[
in that order and you have a neat one-liner that returns the original
data.frame without the adjacent duplicates.
And since I did not say exactly how to do it, you will be able to claim
that you "figured out the way" albeit with assistance. ;-)
In other words, while keeping the 13th value, I want to remove
observations from 6th to 9th.
That is my end goal.
Could you help me reach the goal?
best
moohwan
______________________________________________
R-help@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.
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
______________________________________________
R-help@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.