Eric, Rasmus,

thank you very much,

         ALLPAP  %>%
                 group_by(Provider) %>%
                 mutate( minDt=min(CollectionDate),
                         maxDt=max(CollectionDate)) %>%
                 summarize( minDt = min(minDt),
                         maxDt = max(maxDt), .groups="keep" ) %>%
                 ungroup() %>%
                 mutate(MAX_MIN_DATE = max(minDt),
                         MIN_MAX_DATE = min(maxDt)) %>%
                 distinct(MAX_MIN_DATE, MIN_MAX_DATE)

gives me

         # A tibble: 1 x 2
                MAX_MIN_DATE MIN_MAX_DATE
                <chr>        <chr>       
         1 2010-02-05   2019-08-30  

which is correct, and what I wanted.

This is so cool :-)-O

el

On 21/08/2020 11:41, Eric Berger wrote:
> Hi Eberhard,
> Here is one possibility using dplyr. 
[...]
> 
> HTH,
> Eric
> 
> 
> On Fri, Aug 21, 2020 at 12:34 PM Rasmus Liland <j...@posteo.no> wrote:
>> On 2020-08-21 09:03 +0200, Dr Eberhard Lisse wrote:
[...]
>> 
>> Dear Eberhard,
>> 
>> Is each report in a csv file with those two columns, and you want to
>> unify them into a dataframe with CollectionDate along the rows, and
>> other details for each provider along the columns?  This can be done
>> with various apply calls and reshape.  Can you please subset some
>> more example data here using dput.  It makes it so much easier.
>> 
>> /Rasmus
[...]
-- 
Dr. Eberhard W. Lisse   \         /       Obstetrician & Gynaecologist 
e...@lisse.na             / *      |  Telephone: +264 81 124 6733 (cell)
PO Box 8421 Bachbrecht  \      /  If this email is signed with GPG/PGP
10007, Namibia           ;____/ Sect 20 of Act No. 4 of 2019 may apply

-- 
If you want to email me, replace nospam with el

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to