如何解决R中强制引入的NA?

时间:2019-11-14 15:54:11

标签: r stringr

participated in the review for their constructive contributions, and to the international organizations. He urged them to continue to show solidarity with C™te dÕIvoire. In closing, he said that, more than ever, C™te dÕIvoire needed their support in order to attain its objectives ahead of 2020. 

*II. Conclusions and/or recommendations*
127. The recommendations listed below enjoy the support of C™te dÕIvoire: 
127.1 Consider the accession to core human rights instruments (Lesotho); and to other main international human rights treaties that it is not yet a party to (Philippines); 
127.2 Make efforts towards the ratification of the OP-CAT (Chile); 
127.3 Ratify the OP-CAT (Ghana, Tunisia), as recommended previously in 2009 (Czech Republic) and take policy measures to prevent torture and ill-treatment (Estonia);

这是我的文字,我想提取 II之后的所有内容。结论和/或建议 我尝试了以下方法;

x <- substring(text, first = "II. Conclusions and/or recommendations\n")

但是我得到了强制性引入的NA。我该怎么做才能使它更好?

1 个答案:

答案 0 :(得分:0)

l == list(range(l[0], l[-1] + 1))

使用此:

text <- "participated in the review for their constructive contributions, and to the international organizations. He urged them to continue to show solidarity with C™te dÕIvoire. In closing, he said that, more than ever, C™te dÕIvoire needed their support in order to attain its objectives ahead of 2020. 

*II. Conclusions and/or recommendations*
127. The recommendations listed below enjoy the support of C™te dÕIvoire: 
127.1 Consider the accession to core human rights instruments (Lesotho); and to other main international human rights treaties that it is not yet a party to (Philippines); 
127.2 Make efforts towards the ratification of the OP-CAT (Chile); 
127.3 Ratify the OP-CAT (Ghana, Tunisia), as recommended previously in 2009 (Czech Republic) and take policy measures to prevent torture and ill-treatment (Estonia);"

或者通过将起始位置设置为整数:

substring(text, regexpr("II.", text))