基于R中的正则表达式创建换行符

基于R中的正则表达式创建换行符,r,split,lines,R,Split,Lines,我是新来R的。我从网上提取了一些文本并粘贴到一个文本文件中。它们看起来像这样 c("HR name as meena in malad west branch first source ltd called me for interview as openings in llyods chat process as banking process she told me 3 rounds of interview and other hr vl ask me these question

我是新来R的。我从网上提取了一些文本并粘贴到一个文本文件中。它们看起来像这样

    c("HR name as meena in malad west branch first source ltd called me for interview as openings in llyods chat process as banking process she told me 3 rounds of interview and other hr vl ask me these questions.As she said there r openings but when other hr taken my interview she told there r no...", 
"", "", "Sir with due respect from 7 nov 2015, i dont receive my sms alerts from my registered mobile number as 9596159288 . ", 
"Account name Tariq Ahmad Mir", "Branch: WATRIGAM", "Contact: 1954-235307", 
"", "IFSC Code: SBIN0004591 ", "", "", "MICR Code: 193002321..."
每个注释在注释末尾用“…”分隔。我试图将每条评论连接成一行。我尝试了以下代码:

a <- readLines("banking1.txt", warn = FALSE)
a <- a[sapply(a, nchar) > 0]
a <- paste(a, collapse = ",")
我正在尝试使用。。。定界符

a <- strsplit(a, "...,")
a <- strsplit(a, "...,")[[1]]
a <- noquote(strsplit(a, "...,")[[1]]) 

有人能帮忙吗?

你可以用否定的后视

x <- c("HR name as meena in malad west branch first source ltd called me for interview as openings in llyods chat process as banking process she told me 3 rounds of interview and other hr vl ask me these questions.As she said there r openings but when other hr taken my interview she told there r no...", 
  "", "", "Sir with due respect from 7 nov 2015, i dont receive my sms alerts from my registered mobile number as 9596159288 . ", 
  "Account name Tariq Ahmad Mir", "Branch: WATRIGAM", "Contact: 1954-235307", 
  "", "IFSC Code: SBIN0004591 ", "", "", "MICR Code: 193002321...")
y <- paste(x, collapse="\n")
z <- gsub("(?<!\\.{3})\\n+", " ", y, perl=TRUE) 
z <- strsplit(z, "\n")

x

我向Avinash Raj道歉……您的代码很有帮助……但我刚刚意识到我粘贴了格式化输出,当我应用您的解决方案时……它不起作用……我现在已经更正了示例数据……请您帮忙好吗?非常感谢Avinash Raj。你的代码帮了大忙。但是由于使用了
cat
我无法将输出存储到变量…只是做了一些调整以适应我的情况<代码>z<代码>z
HR name as meena in malad west branch first source ltd called me for interview as openings in llyods chat process as banking process she told me 3 rounds of interview and other hr vl ask me these questions.As she said there r openings but when other hr taken my interview she told there r no...
Sir with due respect from 7 nov 2015, i dont receive my sms alerts from my registered mobile number as 9512139288 . Account name Tariq Ahmad Mir Branch: MAGRITAW Contact: 1954-235307 IFSC Code: AVCN0001234 MICR Code: 19300321...
x <- c("HR name as meena in malad west branch first source ltd called me for interview as openings in llyods chat process as banking process she told me 3 rounds of interview and other hr vl ask me these questions.As she said there r openings but when other hr taken my interview she told there r no...", 
  "", "", "Sir with due respect from 7 nov 2015, i dont receive my sms alerts from my registered mobile number as 9596159288 . ", 
  "Account name Tariq Ahmad Mir", "Branch: WATRIGAM", "Contact: 1954-235307", 
  "", "IFSC Code: SBIN0004591 ", "", "", "MICR Code: 193002321...")
y <- paste(x, collapse="\n")
z <- gsub("(?<!\\.{3})\\n+", " ", y, perl=TRUE) 
z <- strsplit(z, "\n")