Thank you for the explanation, Peter.
Angel
-Mensaje original-
De: peter dalgaard [mailto:pda...@gmail.com]
Enviado el: lun 01/09/2014 20:10
Para: Angel Rodriguez
CC: r-help
Asunto: Re: [R] Unexpected behavior when giving a value to a new variable based
on the value of another variable
ed).
>
> Best regards,
>
> Angel Rodriguez-Laso
>
>
> -Mensaje original-
> De: John McKown [mailto:john.archie.mck...@gmail.com]
> Enviado el: vie 29/08/2014 14:46
> Para: Angel Rodriguez
> CC: r-help
> Asunto: Re: [R] Unexpected behavior when giv
been
oversimplified).
Best regards,
Angel Rodriguez-Laso
-Mensaje original-
De: John McKown [mailto:john.archie.mck...@gmail.com]
Enviado el: vie 29/08/2014 14:46
Para: Angel Rodriguez
CC: r-help
Asunto: Re: [R] Unexpected behavior when giving a value to a new variable based
on the value of an
One clue is the help file for "$"...
?" $"
In particular there see the discussion of character indices and the "exact"
argument.
You can also find this discussed in the Introduction to R document that comes
with the software.
On Fri, Aug 29, 2014 at 3:53 AM, Angel Rodriguez
wrote:
>
> Dear subscribers,
>
> I've found that if there is a variable in the dataframe with a name very
> similar to a new variable, R does not give the correct values to this latter
> variable based on the values of a third value:
>
>
>
> Any
You are being bitten by the "partial matching" of the "$" operator
(see ?"$" for a better explanation). Here is solution that works:
**original**
> N <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58), V2 = c(NA, 1,
> 1, 1, 1,1,1,1,NA)),
+ .Names = c("age","sample
Dear subscribers,
I've found that if there is a variable in the dataframe with a name very
similar to a new variable, R does not give the correct values to this latter
variable based on the values of a third value:
> M <- structure(list(V1 = c(67, 62, 74, 61, 60, 55, 60, 59, 58)),.Names =
>
7 matches
Mail list logo