Wednesday 15 April 2015

R : Re-scale data -



R : Re-scale data -

i'm using r , cars info frame.

i want test :

1/ scale "cars" info in cars.scale

2/ unscale cars.scale in order check if recover "cars" data

i did doesn't work

data(cars) library(dmwr) cars.scale<- scale(cars) head(cars) head(cars.scale) original_data <- unscale(cars.scale, cars)

i obtain error message :"error in -centers : invalid argument unary operator"

could please help me understand what's wrong ?

if read cran manual, have reply there. first argument in function "a numeric matrix values un-scale", cars.scale. sec argument "an object function scale() applied", cars.scale.

original_data <- unscale(cars.scale, cars.scale) # speed dist # [1,] 4 2 # [2,] 4 10 # [3,] 7 4 # [4,] 7 22 # [5,] 8 16

from cran manual

unscale(vals, norm.data, col.ids)

arguments

vals numeric matrix values un-scale


norm.data numeric , scaled matrix. should object function scale() applied.

col.ids columns of vals matrix un-scaled (defaults of them).

r

No comments:

Post a Comment