R/clean.text.R

Defines functions clean.text

clean.text	=	function(text,add.period=FALSE){
	
	text	<-	sub("\\n\\n","",text)
	text	<-	sub("\n\n","",text)
	text	<-	sub("\n","",text)
	text	<-	sub("\\. . ","\\. ",text,fixed = TRUE)
	text	<-	sub("\\.. ","\\. ",text,fixed = TRUE)
	text	<-	sub(".. ",". ",text,fixed = TRUE)
	if (tail(text,1)!='.' && add.period){
		text	<-	paste(text,'.',sep='')
	}
	return(text)
}
USGS-R/hazardItems documentation built on Aug. 15, 2020, 11:28 a.m.