[R] recoding charactor variables with special charactors

John Kane jrkrideau at yahoo.ca
Thu Jul 2 14:52:19 CEST 2009


First of all try str(socia) and see what the structure of the data is.  R seems to be interpreting that character string as a format If I am reading the error message correctly.  

--- On Wed, 7/1/09, Chris Anderson <chris6764 at netzero.net> wrote:

> From: Chris Anderson <chris6764 at netzero.net>
> Subject: [R] recoding charactor variables with special charactors
> To: r-help at r-project.org
> Received: Wednesday, July 1, 2009, 3:43 PM
> 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 at 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.
> 


      __________________________________________________________________
Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it N



More information about the R-help mailing list