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
Thank you John, Jim, Jeff and both Davids for your answers.
After trying different combinations of values for the variable samplem, it
looks like if age is greater than 65, R applies the correct code 1 whatever the
value of samplem, but if age is less than 65, it just copies the values of
On 01 Sep 2014, at 13:08 , Angel Rodriguez angel.rodrig...@matiainstituto.net
wrote:
Thank you John, Jim, Jeff and both Davids for your answers.
After trying different combinations of values for the variable samplem, it
looks like if age is greater than 65, R applies the correct code 1
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 =
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,samplem),
On Fri, Aug 29, 2014 at 3:53 AM, Angel Rodriguez
angel.rodrig...@matiainstituto.net 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
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.
7 matches
Mail list logo