[R] removing contractions for recode in car

David Winsemius dwinsemius at comcast.net
Thu Dec 15 22:12:33 CET 2011


You can either use "\" to escape a character or you can mix two kinds  
of quotes. If you used double quotes around your text entries you can  
have singel quotes in the "interior of the text.

 > 'test of bslash-single-quote \' continues'
[1] "test of bslash-single-quote ' continues"
 > "test of isolated single-quote ' continues"
[1] "test of isolated single-quote ' continues"

On Dec 15, 2011, at 3:49 PM, Nicole Marie Ford wrote:

> hello,
>
> i need to recode a variable, however the contraction is causing  
> problems.  i had the code to change this written down somewhere and  
> i just can't find it, of course.
>
> i am using the car library to recode.
>
> it's only 5 levels when it should have 6... when i do levels(trust).
>
> here is my recode:
>
>
> trust <- recode(Poland$SN35B, " 'Strongly Agree' = 1; 'Agree' = 2;  
> 'Neither Agree nor Disagree' = 3; 'Disagree' = 4; 'Strongly  
> Disagree' = 5; 'Can't choose' = 6; else=NA")
>
>
> thanks.
>
> ~nicole
> ----- Original Message -----
> From: "David Winsemius" <dwinsemius at comcast.net>
> To: "Rui Barradas" <ruipbarradas at sapo.pt>
> Cc: r-help at r-project.org
> Sent: Thursday, December 15, 2011 2:33:32 PM
> Subject: Re: [R] printing all htest class members
>
>
> On Dec 15, 2011, at 2:16 PM, Rui Barradas wrote:
>
>> You're right, David,
>>
>> The first line is wrong, it should be
>>
>> ...  df=2:4  ...
>>
>> As for creating something, try
>>
>>> ht <- structure( ... etc ...
>>> ht
>>> class(ht)
>>
>> See what is printed and what function prints it.
>
> Well, the function is stats:::print.htest.
>
> (Do not expect any further replies to emails sent without context.)
>
> #---------------------------------------------------#
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> #---------------------------------------------------#
>>
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> 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.
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list