Re: [R] reexpr transform nonumeric values to numeric

2012-08-21 Thread PIKAL Petr
;^([[:digit:]]..*{1,4})-$","-\\1",temp)) > #or > as.numeric(gsub("^(.*.[[:digit:]]{1,4})-$","-\\1",temp)) > A.K. > > > > > ----- Original Message - > From: PIKAL Petr > To: r-help > Cc: > Sent: Tuesday, August 21, 2012 6:16

Re: [R] reexpr transform nonumeric values to numeric

2012-08-21 Thread arun
[:digit:]]{1,4})-$","-\\1",temp)) A.K. - Original Message - From: PIKAL Petr To: r-help Cc: Sent: Tuesday, August 21, 2012 6:16 AM Subject: [R] reexpr transform nonumeric values to numeric Dear all I have got this kind of data temp <- structure(c(1L, 1L, 1L, 1L, 1L, 16L,

Re: [R] reexpr transform nonumeric values to numeric

2012-08-21 Thread PIKAL Petr
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

Re: [R] reexpr transform nonumeric values to numeric

2012-08-21 Thread Noia Raindrops
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

[R] reexpr transform nonumeric values to numeric

2012-08-21 Thread PIKAL Petr
Dear all I have got this kind of data temp <- structure(c(1L, 1L, 1L, 1L, 1L, 16L, 6L, 6L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 11L, 10L, 16L, 16L, 16L, 21L, 16L, 16L, 16L, 1L, 1L, 1L, 16L, 16L, 16L, 16L, 1L, 1L, 7L, 3L, 1L, 1L, 1L, 1L, 3L, 3L, 1L, 1L, 1L, 4L, 10L,