On Thu, Feb 23, 2012 at 04:40:07PM -, Ted Harding wrote:
[...]
> A basic solution for this special case would be
>
> zt=function(x){
> if (sd(x) == 0) return(0*x) else return( (x-mean(x))/sd(x) )
> }
>
> This should cover the case where length(table(x))==1 (see also below).
>
> I'm n
On 23-Feb-2012 Jonathan Williams wrote:
> Dear Helpers,
> I wrote a simple function to standardise variables if they
> contain more than one value. If the elements of the variable
> are all identical, then I want the function to return zero.
>
> When I submit variables whose elements are all ident
Dear Helpers,
I wrote a simple function to standardise variables if they contain more than
one value. If the elements of the variable are all identical, then I want the
function to return zero.
When I submit variables whose elements are all identical to the function, it
returns not zero, but
3 matches
Mail list logo