[R] Help with selection of continuous data

André Luis Neves @ndr|u|@ @end|ng |rom u@|bert@@c@
Mon Jun 21 09:22:44 CEST 2021


Dear R users,

I want to select only the data containing a continuous number of *ID* from
1-8 in each *DATE*. Note, I do not want to select data that do not contain
a continuous number in *ID *from 1-8 (eg. Data on *DATE* 1/2/2020, and
01/03/2020). The dataset is a huge matrix with 24 columns and 1.5 million
rows, but I have prepared a reproducible code for your reference below.

Here it is the reproducible code:

A =
data.frame(c("01/01/2020","01/01/2020","01/01/2020","01/01/2020","01/01/2020","01/01/2020","01/01/2020",

 "01/01/2020","01/01/2020","01/01/2020","01/01/2020","01/01/2020","01/02/2020","01/02/2020",

 "01/02/2020","01/02/2020","01/03/2020","01/03/2020","01/03/2020","01/03/2020","01/03/2020",

 "01/03/2020","01/03/2020","01/04/2020","01/04/2020","01/04/2020","01/04/2020","01/04/2020",
               "01/04/2020","01/04/2020","01/04/2020","01/04/2020"),
c(23,22,12,24,26,19,34,15,17,19,23,33,

 23,34,25,23,25,24,34,33,31,32,24,22,21,23,22,22,21,23,23,21),
c(13,11,12,9,8,9,7,10,11,9,6,11,
               9,8,9,10,11,12,9,8,10,4,6,9,8,9,10,11,14,12,13,11),
c(1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,1,2,
               3,4,5,6,7,1,2,3,4,5,6,7,8,9))
colnames(A) <- c("Date", "CO2", "CH4", "ID")
A

Thank you,
-- 
Andre

	[[alternative HTML version deleted]]



More information about the R-help mailing list