[R] how to remove NaN columns ?
Spencer Graves
spencer.graves at pdf.com
Fri Oct 24 21:57:10 CEST 2003
Have you considered the following:
> x <- 1:11
> xs <- scale(x)
> xs
[,1]
[1,] -1.5075567
[2,] -1.2060454
...
[11,] 1.5075567
attr(,"scaled:center")
[1] 6
attr(,"scaled:scale")
[1] 3.316625
> attr(xs, "scaled:center")
[1] 6
hope this helps. spencer graves
ryszard.czerminski at pharma.novartis.com wrote:
>Nice!
>
>I noticed that in generated structure it has two attributes
>attr(,"scaled:center") and attr(,"scaled:scale")
>How can I access them ?
>
>R
>
>
>
>
>
>Giovanni Petris <GPetris at uark.edu>
>10/24/2003 02:50 PM
>Please respond to Giovanni Petris
>
>
> To: Ryszard Czerminski/PH/Novartis at PH
> cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] how to remove NaN columns ?
>
>
>
>
>
>>>xs <- lapply(xdata, function(x){(x - mean(x))/sqrt(var(x))})
>>>
>>>
>
>Incidentally, the function 'scale' does just that.
>
>
>
More information about the R-help
mailing list