Re: [R] filter() question

2020-08-21 Thread Dr Eberhard Lisse
Rasmus, thank you, I am an elderly Gynecologist, dabbling a little, ie exactly the clientele for which the tidyverse "thingy" was developed :-)-O. In addition I like readable code so I later understand what I was trying to do :-)-O el On 2020-08-21 16:15 , Rasmus Liland wrote: > On

Re: [R] filter() question

2020-08-21 Thread Rasmus Liland
On 2020-08-21 13:45 +0200, Dr Eberhard Lisse wrote: | | Eric, Rasmus, | | thank you very much, | |ALLPAP %>% |group_by(Provider) %>% |mutate( minDt=min(CollectionDate), |maxDt=max(CollectionDate)) %>% |summarize(

Re: [R] filter() question

2020-08-21 Thread Jeff Newmiller
Using mutate followed by summarise in this case is completely unnecessary. a <- ( lDf %>% dplyr::group_by( Provider ) %>% dplyr::summarise( u = min( CollectionDate ) ,, v = max( CollectionDate ) ) ) On August 21, 2020 2:41:26 AM

Re: [R] filter() question

2020-08-21 Thread Dr Eberhard Lisse
Eric, Rasmus, thank you very much, ALLPAP %>% group_by(Provider) %>% mutate( minDt=min(CollectionDate), maxDt=max(CollectionDate)) %>% summarize( minDt = min(minDt), maxDt = max(maxDt),

Re: [R] filter() question

2020-08-21 Thread Eric Berger
Hi Eberhard, Here is one possibility using dplyr. library(dplyr) set.seed(3) ## set up some fake data dtV <- as.Date("2020-08-01") + 0:4 x <- sample(dtV,20,repl=TRUE) provider <- sample(LETTERS[1:3],20,repl=TRUE) lDf <- data.frame(Provider=provider,CollectionDate=x,stringsAsFactors=FALSE) ##

Re: [R] filter() question

2020-08-21 Thread Rasmus Liland
On 2020-08-21 09:03 +0200, Dr Eberhard Lisse wrote: > Hi, > > I have a small test sample with lab > reports (PAP smears) from a number of > different providers. These have > Collection Dates and the relevant > columns glimpse() something like > this: > > $ Provider"Dr C", "Dr D",

[R] filter() question

2020-08-21 Thread Dr Eberhard Lisse
Hi, I have a small test sample with lab reports (PAP smears) from a number of different providers. These have Collection Dates and the relevant columns glimpse() something like this: $ Provider"Dr C", "Dr D", "Dr C", "Dr D" $ CollectionDate "2016-11-03", "2016-11-02", "2016-11-03",