Hi,
May be this helps:
dat1 <- read.table(text="line start
? A1 21
? A2 22
? A3 23
? B4 19
? B2 24
? B6 12",sep="",header=TRUE,stringsAsFactors=FALSE)
dat1[c(TRUE,diff(dat1[,2]) >0 ),]
#? line start
#1?? A1??? 21
#2?? A2??? 22
#3?? A3??? 23
#5?? B2??? 24
A.K.
On Thursday, January 2, 2014 10:54 AM, raz <barvazduck at gmail.com>
wrote:
Hi,
I would like to compare row data in the same column through a data frame
and remove all rows that do not fit the criteria.
for example if I have the following data frame:
? line start? A1 21? A2 22? A3 23? B4 19? B2 24? B6 12
I would like to compare the 'start' value of each line to the value of
next
line (22-21,23-22,19-23,24-19,12-24) and if it is smaller then to remove
the line so that at the end I would get
? line start? A1 21? A2 22? A3 23? B2 24
Thanks,
--
\m/
??? [[alternative HTML version deleted]]
______________________________________________
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.