[R] Changing Character Value

arun
Thu, 13 Feb 2014 22:16:36 -0000

Hi Farnoosh,
If I understand it correctly,
dat <-read.table(text="Var1

Great>5
great
'less great<2'
'approx
great11'",sep="",header=TRUE,stringsAsFactors=FALSE)
?dat$Var1 <-
gsub(".*(great).*","\\L\\1",dat$Var1,ignore.case=TRUE,perl=TRUE)
?dat$Var1
#[1] "great" "great" "great" "great"
A.K.

On Thursday, February 13, 2014 5:04 PM, farnoosh sheikhi <farnoosh_81 at
yahoo.com> wrote:

Hi Arun,

One more questions, I have a column which is a character column like below. I
want to replace these values to a unique value like great.
How do I do that?
Thanks.


Var1
Great>5
great
less great<2
approx great11

Regards,?Farnoosh Sheikhi