R code - converting date to single values

Hi

Completely new to R. Can't upload a sample of the data I am looking at as markdown not working. I have a set of blood test results eg FBC, UE approximately 9 episodes per blood test per patient, all in date format. I need to know which dates are the same and count per patient how many different dates there are.

I don't have an index date of diagnosis.

How do I set the earliest date per row and count how many from that are done per row?

Thank you anyone that can help with what is probably an easy task!

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue (you can use made-up data resembling your actual data)? Please have a look at this guide, to see how to create one:

That is not copy/paste friendly, please read the guide I gave you and try to provide a proper reproducible example.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Hi - thanks for being patient:

head (Blood2,5)
ï..Patient AltSerum1Date AltSerum2Date AltSerum3Date AltSerum4Date AltSerum5Date AltSerum6Date AltSerum7Date
1 1 09/07/2016
2 2
3 3 1/28/2016 05/05/2016 09/02/2016
4 4 06/11/2015
5 5
AltSerum8Date AltSerum9Date AltSerum10Date Calcium1Date Calcium2Date Calcium3Date Calcium4Date Calcium5Date
1 NA NA NA NA NA NA
2 NA NA NA NA NA NA
3 NA NA NA NA NA NA
4 NA NA NA 06/11/2015 NA NA NA
5 NA NA NA 3/31/2015 NA NA NA
Creatinine1Date Creatinine2Date Creatinine3Date Creatinine4Date Creatinine5Date Creatinine6Date Creatinine7Date
1 09/07/2016
2
3 1/28/2016 05/05/2016 09/02/2016
4 06/11/2015
5 3/31/2015
Creatinine8Date Creatinine9Date CRP1Date CRP2Date eGFR1Date eGFR2Date eGFR3Date eGFR4Date eGFR5Date eGFR6Date
1 NA NA 09/07/2016
2 NA NA
3 NA NA 1/28/2016 05/05/2016 09/02/2016
4 NA NA 06/11/2015
5 NA NA 3/31/2015
eGFR7Date eGFR8Date eGFR9Date FBC1Date FBC2Date FBC3Date FBC4Date FBC5Date FBC6Date FBC7Date FBC8Date FBC9Date
1 NA NA 09/07/2016
2 NA NA
3 NA NA 1/28/2016 05/05/2016 09/02/2016
4 NA NA 06/11/2015
5 NA NA 3/31/2015
FBC10Date Haemoglobin1Date Haemoglobin2Date Haemoglobin3Date Haemoglobin4Date Haemoglobin5Date Haemoglobin6Date
1 NA 09/07/2016
2 NA
3 NA 1/28/2016 05/05/2016 09/02/2016
4 NA 06/11/2015
5 NA 3/31/2015
Haemoglobin7Date Haemoglobin8Date Haemoglobin9Date Haemoglobin10Date Haemoglobin11Date LiverFunction1Date
1 NA NA 09/07/2016
2 NA NA
3 NA NA 1/28/2016
4 NA NA 06/11/2015
5 NA NA
LiverFunction2Date LiverFunction3Date LiverFunction4Date LiverFunction5Date LiverFunction6Date LiverFunction7Date
1
2
3 05/05/2016 09/02/2016
4
5
LiverFunction8Date LiverFunction9Date LiverFunction10Date PlateletCount1Date PlateletCount2Date PlateletCount3Date
1 NA 09/07/2016
2 NA
3 NA 1/28/2016 05/05/2016 09/02/2016
4 NA 06/11/2015
5 NA 3/31/2015
PlateletCount4Date PlateletCount5Date PlateletCount6Date PlateletCount7Date PlateletCount8Date PlateletCount9Date
1
2
3
4
5
PlateletCount10Date PlateletCount11Date Urea1Date Urea2Date Urea3Date Urea4Date Urea5Date Urea6Date Urea7Date
1 NA NA 09/07/2016 09/07/2016
2 NA NA
3 NA NA 1/28/2016 05/05/2016 09/02/2016
4 NA NA 06/11/2015 06/11/2015
5 NA NA 3/31/2015 3/31/2015
Urea8Date Urea9Date Urea10Date Urea11Date Urea12Date Urea13Date Urea14Date
1
2
3
4
5