[R] Update data in text file with data in dataframe
Nic
ncecchino at gmail.com
Sat Aug 19 19:39:26 CEST 2017
Hello all,
I'm a novice R programmer and I don't have a clue as to how to approach
this. I have tried many different approaches only to fail and I can't
seem to wrap my head around it. So I turn to the experts.
I have a text file with patient data that has incorrect dates of
service. I need to update the dates of service in the text file with
data that's in a dataframe.
Data in the text file looks like this (call it PatRecs):
PatientID #: 12345
Date of Service: 8/1/2017
.
.
.
PatientID #: 12346
Date of Service: 8/2/2017
.
.
.
The dots are other data. I'm just focused on the PatientID and DOS.
The data in the data frame (call it DF) looks like
Id2 DOS
12345, 8/3/2017
12346, 8/4/2017
etc.
The lists for both are longer than this.
I know that in programming for this that there should be readLines and
writeLines and greps - but I'm far too new to using R to figure out the
usage of these commands.
How can I update the text file (PatRecs) with the incorrect Date of
Service, with the correct DOS in the dataframe (DF)???
This is not a homework assignment, I promise. This is just my attempt
to automate data quality using R, and so that I can learn something
new. In any event, providing you with anything I've done so far would
be meaningless. In an effort to minimize email space, please email me
directly. If there is any interest I'll compile the responses and
forward them. I humbly thank you all for any assistance with this.
Best,
Nic
More information about the R-help
mailing list