It's because the levels of factor, don't characters:

f <- factor(c("AAA's", "B(s)", "CCC"))
levels(f)[levels(f) == "AAA's"] <- "AAAAAA"


On Wed, Jul 1, 2009 at 4:43 PM, Chris Anderson <chris6764@netzero.net>wrote:

> I have a several character variables that I need to recode, but some of
> them have special characters like single quote or ( ). How tell R to ignore
> these special characters so I can rename them? Below is the error message I
> am getting.
>
> social$FamilySupport[social$FamilySupport=="Mr. XXXs' extended family live
> in the Nashville area where he and his wife reside."]<-"Highly Supportive"
> Warning in `[<-.factor`(`*tmp*`, social$FamilySupport == "Mr. XXXs'
> extended family live in the Nashville area where he and his wife reside.",
>  :
>  invalid factor level, NAs generated
>
>
>
> Chris Anderson
> 707.315.8486
> www.sassydeals4u.com
> ____________________________________________________________
> Click to find deals on color printers and inks.
>
> http://thirdpartyoffers.netzero.net/TGL2241/fc/BLSrjpYR5fJC7MeC1xbOpWpulSKIYlbNvfa8G3h7se8nrP9RvM2utx3A3bK/
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


