首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >提取R中字符变量的特殊字符串

提取R中字符变量的特殊字符串
EN

Stack Overflow用户
提问于 2016-07-20 01:53:19
回答 1查看 47关注 0票数 0

我有一些角色,典型的角色如下所示。

代码语言:javascript
复制
{
    "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中有没有更简单的方法呢?

EN

回答 1

Stack Overflow用户

发布于 2016-07-20 06:36:43

代码语言:javascript
复制
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])
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38465333

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档