我試圖將多行文本文件轉換爲單行。以下是一個例子:將多行文本轉換爲R中的單行
body <- c("Dear Recruiter", "Greetings from NaukriOverseasCom ", "Please find attached CVs of candidates in our database If you have an open",
"position matching with their profile please contact himher directly",
"This service is free however if you dont wish to receive CVs please reply",
"with subject DND", "Sincerely", "Administrator", "NaukriOverseascom",
"Email adminnaukrioverseascom", "Web httpwwwnaukrioverseascom",
" httpwwwnaukrioverseascom", "Please do not print this email unless it is absolutely necessary",
"DISCLAIMER The information contained in this electronic message and any",
"attachments to this message are intended for the exclusive use of the",
"addressees and may contain proprietary confidential or privileged",
"information If you are not the intended recipient you should not",
"disseminate distribute or copy this email Please notify the sender",
"immediately and destroy all copies of this message and any attachments",
"WARNING Computer viruses can be transmitted via email The recipient should",
"check this email and any attachments for the presence of viruses The",
"company accepts no liability for any damage caused by any virus transmitted",
"by this email")
我使用以下代碼的嘗試:
bod <- cat(str_wrap(body))
雖然我正在在控制檯輸出,對象BOD是越來越存儲爲NULL。是因爲弦的長度嗎?
[R,將多行文本數據幀合併到一個單元格中]可能的重複(http://stackoverflow.com/questions/20854615/r-merge-multiple-行 - 文本 - 數據 - 幀 - 到 - 單元) – 2015-11-08 03:04:46