I have raw data in this txt format:
Name|Occupation|Comment
Robert|Doctor|To process, please provide:
a. Tax Returns
b. Identification
c. Statement of Approval
Sally|Accountant|Approved
Here, |
is the delimiter.
For Robert, I want "To process, please provide: a. Tax Returns b. Identification c. Statement of Approval" to be reflected as one string under Comment
.
However, using read.csv
to import with the following arguments:
read.csv(
"data/text_data",
fileEncoding = "UTF-8",
sep = "|",
na.strings = "",
quote = ""
)
gives me additional rows where
Name Occupation Comment
Robert Doctor To process, please provide:
a. Tax Returns NA NA
b. Identification NA NA
c. Statement of Approval NA NA
Sally Accountant Approved
Are there any R import functions or wrangling tricks to fix this? Tidyverse solution is highly preferred, thanks.