[R] creating selection vector with 2 attributes
Gavin Simpson
gavin.simpson at ucl.ac.uk
Tue Aug 11 09:54:21 CEST 2009
On Mon, 2009-08-10 at 16:57 -0700, PDXRugger wrote:
> Please consider the following:
<snip />
>
> IsEugene <- Hhdata$Puma %in%
> PumsAreaNames..$PumaNums[(PumsAreaNames..$PumaNames == "Eugene")]
I presume the .. before the $ are just a typo here?
>
> #------------------------------------------
>
> Is Eugene returns a true/false for whether the Hhdata$Puma attribute matches
> 'Eugene". I would also like it to associate the serial number but not in a
> dataframe form but rather like the following:
you want to change the names() of IsEugene. Assuming the serials are in
Serial, then
names(IsEugene) <- Serial
should do it, but it will be the other way round, i.e. the serial number
above the T/F.
HTH
G
>
> FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> FALSE
> 9995828 9995840 9995843 9996259 9996287 9996375 9996581 9996724 9996796
> 9997176
> FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> FALSE
> 9997492 9997546 9997664 9997924 9998062 9998073 9998216 9998682 9998691
> 9998721
> FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE
> FALSE
> 9998740 9999082 9999198 9999331 9999390 9999805 9999811
> FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>
> Where the numerics are the serial number. The reason i am having trouble
> is that i am using some existing code and the desired above is what is
> returned form the original code and the new code returns just the logical
> values. I have done the obvious and made sure my data is in the correct
> format which it is so i am wondering if i can just figure out how to move to
> what i need. Thanks everyone.
>
> JR
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list