[R] Regular Expressions in grep - Solution and function to determine significant figures of a number
Bert Gunter
gunter.berton at gene.com
Wed Aug 22 21:53:05 CEST 2012
...
On Wed, Aug 22, 2012 at 12:46 PM, Dr. Holger van Lishaut
<H.v.Lishaut at gmx.de> wrote:
> 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.
except that ?signif already does this, no?
-- Bert
>
> Thanks & best regards
> H. van Lishaut
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
More information about the R-help
mailing list