Thanks
I new that gsub shall be involved somehow, but the key is to use backreference
"-\\1".
Regards
Petr
> -Original Message-
> From: arun [mailto:smartpink...@yahoo.com]
> Sent: Tuesday, August 21, 2012 2:51 PM
> To: PIKAL Petr
> Cc: R help
> Subje
HI,
Try this:
as.numeric(gsub("^([0-9].[0-9]{1,4})-$","-\\1",temp))
#or
as.numeric(gsub("^([[:digit:]].[[:digit:]]{1,4})-$","-\\1",temp))
#or
as.numeric(gsub("^([[:digit:]]..*{1,4})-$","-\\1",temp))
#or
as.numeric(gsub("^(.*.[[:digit:]]{1,4})-$","-\\1",temp))
A.K.
- Original Message -
F
Thank you
I knew that somebody can use power of gsub better than myself.
Petr
> -Original Message-
> From: Noia Raindrops [mailto:noia.raindr...@gmail.com]
> Sent: Tuesday, August 21, 2012 12:33 PM
> To: PIKAL Petr
> Cc: r-help
> Subject: Re: [R] reexpr transform n
Use backreference:
as.numeric(gsub("^(.*)-$", "-\\1", as.character(temp)))
--
Noia Raindrops
noia.raindr...@gmail.com
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-proje
4 matches
Mail list logo