Hi Thomas,
Would this work:
res1=aggregate(dta[,"fcst"],by=list(basistime=dta[,"basistime"]),FUN=max)
mm=match(paste(res1[,"basistime"],res1[,"x"]),paste(dta[,"basistime"],dta[,"fcst"]))
dta[mm,]
> dta[mm,]
date basistime fcst usgs
20 2012-01-30 12:00:00 2012-01-25 15:0
On 10/26/2017 4:58 AM, Thomas Adams wrote:
Hi Jeff,
Thank you for the suggestions -- I appreciate your help. Unfortunately, the
result2 has two problems...
(1) there are now 3 date columns (it looks like 2 cols are merged into 1
col)
(2) the output rows should not have any of the basistime date
On Thu, 26 Oct 2017, Thomas Adams wrote:
Hi Jeff,
Thank you for the suggestions -- I appreciate your help. Unfortunately, the
result2 has two problems...
(1) there are now 3 date columns (it looks like 2 cols are merged into 1
col)
No, there are two date columns. Result2 includes the groupin
Hi Jeff,
Thank you for the suggestions -- I appreciate your help. Unfortunately, the
result2 has two problems...
(1) there are now 3 date columns (it looks like 2 cols are merged into 1
col)
(2) the output rows should not have any of the basistime dates repeated
(maybe I misstated the problem); I
Thanks for the dput...
reproducible example of split-apply-combine ###
dta <- structure(list(date = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 20L, 21L, 22L, 23L
5 matches
Mail list logo