0

So, I am trying to build a artificial neural network in R, but when I try to scale my dataset, it doesn't let me and shows a error that says this :

Error in FUN(x, aperm(array(STATS, dims[perm]), order(perm)), ...) :
non-numeric argument to binary operator

In addition: Warning message: In scale.default(yrbs_csv, center = min, scale = max - min) : NAs introduced by coercion

I have checked three different step by step guide on how to make it but can't figure out what's going on

index = sample(seq_len(nrow(yrbs_csv)), size = samplesize)
datatrain=data[index,]

Error in data[index, ] : object of type 'closure' is not subsettable

> datatrain=yrbs_csv[index,]
> datatest=yrbs_csv[-index,]
> max=apply(yrbs_csv,2,max)
> min=apply(yrbs_csv,2,min)

> scaled=as.data.frame(scale(yrbs_csv,center = min,scale=max-min))

Error in FUN(x, aperm(array(STATS, dims[perm]), order(perm)), ...) :
non-numeric argument to binary operator

In addition: Warning message: In scale.default(yrbs_csv, center = min, scale = max - min) : NAs introduced by coercion

Community
  • 1
  • 1
  • It's impossible to provide an exact solution to this without actually having a minimum [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). The problem seems to specific to `yrbs_csv`, `data` or `datatrain`. – onlyphantom Apr 11 '19 at 06:59

1 Answers1

1

I'm pretty sure that the scale() function does not take values for center and scale arguments, but booleans. If you need normalized data, just use

scaled <- scale(yrbs_csv, center = TRUE, scale=TRUE)

Also, do note that the <- operator is a safer bet compared to = to assign variables.

RoB
  • 1,833
  • 11
  • 23