Я пытаюсь удалить первый |
в моих данных. Когда я запускаю следующее:
yy <- y %>%
mutate_all(funs(sub("|", "", .)))
Ничего не происходит.
У меня есть другие вхождения |
в других столбцах, поэтому я не хочу удалять их все. Мне удалось удалить последнее вхождение |
, используя следующее mutate_all(funs(gsub("(.*)\\|(.*)", "\\1\\2", .)))
- Теперь я хочу сделать то же самое, но для первого вхождения.
Данные:
y <- structure(list(grp = c("2902", "9738", "9143", "3990", "10488",
"9581", "10905", "9859", "8787", "8626"), HD = c("| CarrolsRestr 4Q EPS 16c Vs EPS 22c ",
"| Press Release: Fitch Affirms Aeroports de Paris SA at 'A+'; Outlook Stable ",
"| MSC Reports Fiscal 2017 First Quarter Results ", "| Goodrich Announces Third Quarter 2009 Net Income per Diluted Share of $1.14, Adjusts Outlook for Full Year 2009, Provides Outlook for 2010 ",
"| *Vera Bradley 1Q Loss/Shr 4c >VRA ", "| *Fitch Affirms One Re's IFS at 'BBB-'; Outlook Stable ",
"| Johnson Controls 2014 first quarter earnings increase 31 percent on higher revenues and improved profitability; affirms guidance for fiscal 2014 ",
"| eBay Inc. Reports Third Quarter 2017 Results ", "| S&P Rating Shift a Sober Reminder for Australia -- Market Talk ",
"| Jeff Immelt: GE 'Underowned' by Big Investors "), WC = c("| 191 words ",
"| 2,493 words ", "| 2,068 words ", "| 6,275 words ",
"| 3,912 words ", "| 1,907 words ", "| 2,452 words ",
"| 5,227 words ", "| 1,594 words ", "| 920 words ")), class = "data.frame", row.names = c(NA,
-10L))