我有一些角色,典型的角色如下。
{
"body": "Dear Lisa H, \\\n\\\nThank you for staying with us at the Cheshire.We appreciate your feedback and are very happy to hear that you had a wonderful stay. We strive to give the best customer service possible, and are glad that we were consistently able to execute this for you. Thank you for recognizing our staff and we hope that you continue to stay with us in the future. \\\n\\\nSincerely, \\\n\\\nHotel Management",
"date": 1337299200,
"created_at": 1.3374022991266E9,
"_provider": "ThirtyDigits",
"author": "Tony Dandino, General Manager at The Cheshire"
}
我想要的是"Thank you for.......future"
。所以这是第二个"\\\n"
和第三个"\\\n"
之间的单词。在R中有没有更简单的方法呢?
答案 0 :(得分:0)
x<-"Dear Lisa H, \\\n\\\nThank you for staying with us at the Cheshire.
We appreciate your feedback and are very happy to hear that you had
a wonderful stay. We strive to give the best customer service possible,
and are glad that we were consistently able to execute this for you.
Thank you for recognizing our staff and we hope that you continue to
stay with us in the future. \\\n\\\nSincerely, \\\n\\\nHotel Management"
gsub("[\\]","",strsplit(x, "\\\n")[[1]][3])