I have a file that looks like this where someone in the original database added a key incorrectly with a return symbol. How can I read file in R that has a regular repeating LF or other line break in the wrong place? For the sake clarity, suppose I have the following reproduceable example:
example.txt =
ID|Event Date|Code Meaning|Code|Price \n
10020|2017-01-17|scotch tape|01|1.00 \n
10021|2017-02-17|rubber \n duck|02|3.99
10022|2018-03-17|rusty, nail 9000|03|5.99 \n
10023|2016-04-17|rubber \n duck|02|1.99 \n
10024|2015-02-17|scotch tape|01|2.00 \n
where every \n or character code "0x0A" is a line break. I would like to get a file that is like this....
ID| Date|Name|Code|Price \n
10020|2017-01-17|scotch tape|01|1.00 \n
10021|2017-01-17|rubber duck|02|3.99
10022|2017-01-17|rusty, nail 9000|03|5.99 \n
10023|2017-02-17|rubber duck|02| 1.99 \n
10024|2017-02-17|scotch tape|01|2.00 \n
so I can load in the data using something like tidyverse or readr so looks like this...
ID =c(10020,10021,10022,10023,10024)
Date=c("2017-01-17","2017-01-17","2017-01-17","2018-02-17","2017-01-17")
Name=c("scotch tape","rubber duck",rusty, nail 9000","rubber duck","scotch tape")
Price=c(1.00,3.99,5.99,1.99,2.00)
mydata <- data.frame(ID,Date,Name,Price)
View(mydata)
How can I do this in R?