[R] Regular Expressions in grep - Solution and function to determine significant figures of a number

Dr. Holger van Lishaut H.v.Lishaut at gmx.de
Wed Aug 22 21:46:16 CEST 2012


Dear all,

regmatches works.

And, since this has been asked here before:

SignifStellen<-function(x){
     strx=as.character(x)
     nchar(regmatches(strx, regexpr("[1-9][0-9]*\\.[0-9]*[1-9]",strx)))-1
}

returns the significant figures of a number. Perhaps this can help someone.

Thanks & best regards
H. van Lishaut




More information about the R-help mailing list