Re: [R] function doesn't change the variable in the right way

2014-03-07 Thread Rui Barradas
Hello, Inline. Em 07-03-2014 11:17, David Croll escreveu: Dear R users and friends, I would like to ask you about the weird behaviour of a function I just wrote. This little function should take a vector, find NAs and substitute them for the mean of the vector, and return the normalized valu

Re: [R] function doesn't change the variable in the right way

2014-03-07 Thread fabian
Hello The function does exactly what you tell it to do; first you substitute all NA with the mean; then you subtract the mean; for the NA this meand: mean-mean=0; and this is what you get. the problem is not the function but the z-score of means. lg fabian On 07-03-2014 12:17, David Croll

[R] function doesn't change the variable in the right way

2014-03-07 Thread David Croll
Dear R users and friends, I would like to ask you about the weird behaviour of a function I just wrote. This little function should take a vector, find NAs and substitute them for the mean of the vector, and return the normalized value of that vector. I've tried both <- and <<- for changin