2016-08-04 3 views
1

나는 심볼로지를 제거한 페이스 북 게시물 목록을 가지고 있습니다. 이제 저는 텍스트 사이에 간격이 남아 있습니다 - 2 개 또는 그 이상의 공백은 응축하고 싶습니다. 단어 사이에 공백이 하나만 있도록 여분의 공백을 제거하려면 어떻게해야합니까? 또한 어떻게 본문에 나오는 모든 대문자를 제거 할 수 있습니까?공백을 단어 사이의 공백으로 줄입니다.

> head(posts) 
[1] "Syntel Recruitment Drive in this week for FRESHERS New Registration Link 2016 for 2013 2014 2015 Passout Graduates Qualification Any Graduate B E B Tech MCA M E M Tech Syntel Registration Link"    
[2] "Dont Miss This Opportunity to be get placed in one of the best MNC companies in the world eBay freshers this week of January 2016 Qualification Any Graduate Can Apply eBay Registration Link"    
[3] "Recent Pass Outs with 55 or More are eligible to Apply in Wipro Go to the Updated Link for LastDay Reference Drive Jan 2016 Apply Link for Fresher Referral Apply Link"         
[4] "Robert Bosch Recruitment Drive in this week for FRESHERS New Registration Link 2016 for 2013 2014 2015 Passout Graduates Qualification Any Graduate B E B Tech MCA M E M Tech Robert Bosch Registration Link" 
[5] "Mega JOB OPENINGS OF THE YEAR Mphasis Recruitment for FRESHERS January 2016 Qualification BE B Tech B Sc BCA Any Graduates MCA MBA ME M Tech Post Graduates Mphasis Registration Link"   
[6] "TRIGENT Recruitment Drive in this week for FRESHERS New Registration Link 2016 for 2013 2014 2015 Passout Graduates Qualification Any Graduate B E B Tech MCA M E M Tech Trigent Registration Link" 


> dput(head(posts)) 
c("Syntel Recruitment Drive in this week for FRESHERS New Registration Link 2016 for 2013 2014 2015 Passout Graduates Qualification Any Graduate B E B Tech MCA M E M Tech Syntel Registration Link", 
"Dont Miss This Opportunity to be get placed in one of the best MNC companies in the world eBay freshers this week of January 2016 Qualification Any Graduate Can Apply eBay Registration Link", 
"Recent Pass Outs with 55 or More are eligible to Apply in Wipro Go to the Updated Link for LastDay Reference Drive Jan 2016 Apply Link for Fresher Referral Apply Link", 
"Robert Bosch Recruitment Drive in this week for FRESHERS New Registration Link 2016 for 2013 2014 2015 Passout Graduates Qualification Any Graduate B E B Tech MCA M E M Tech Robert Bosch Registration Link", 
"Mega JOB OPENINGS OF THE YEAR Mphasis Recruitment for FRESHERS January 2016 Qualification BE B Tech B Sc BCA Any Graduates MCA MBA ME M Tech Post Graduates Mphasis Registration Link", 
"TRIGENT Recruitment Drive in this week for FRESHERS New Registration Link 2016 for 2013 2014 2015 Passout Graduates Qualification Any Graduate B E B Tech MCA M E M Tech Trigent Registration Link" 
) 

답변

1

gsub 사용하여, 당신은이 하나의 공간에 인접한 공간의 모든 설정을 대체합니다

posts <- gsub(" +", " ", posts) 

을 시도 할 수 있습니다.

관련 문제