[R] function

Jonathan Baron baron at cattell.psych.upenn.edu
Wed Feb 19 04:13:03 CET 2003


On 02/19/03 15:50, skayis at lic.co.nz wrote:
>Dear R users,
>
>I have some R code and trying to understand it. I have a vector
>
> myvec
> [1] 24 24 10 10 10 10 10 44 44 44 45 45 45 54 54 54 54 42 42
>
>and a scaler
>
> myscaler
>[1] 10
>
>The following function:
>match(myvec,myscaler)!="NA"
>
> returns :
>
> [1]   NA   NA TRUE TRUE TRUE TRUE TRUE   NA   NA   NA   NA   NA   NA   NA
>NA   NA   NA   NA    NA
>
>I need a return
>
>FALSE  FALSE TRUE TRUE TRUE TRUE TRUE   FALSE FALSE ...FALSE
>
>Is there any function to perform this?

myvec==myscaler

or the reverse.  The scalar is "recycled."

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
R page:               http://finzi.psych.upenn.edu/




More information about the R-help mailing list