1

I am trying to normalize transactions data.

credit <- read.transactions("directory",sep=",", header="TRUE")
ind <- sample(2, nrow(credit), replace=TRUE, prob=c(0.7, 0.3))
trainData <- credit[ind==1, ]
testData <- credit[ind==2, ]
testData$amount<- ((testData$amount - min(testData$amount)) / (max(testData$amount) - 
min(testDat$amount)))

However, the following error is returned.

Error in testData$amount : $ operator not defined for this S4 class

What is the solution?

Edward
  • 10,360
  • 2
  • 11
  • 26
  • Operator `@`? As in `testData@amount` or maybe `testData@.Data$amount`. Check `str(testData)` to see its structure or the Value section of the function that created that object. – Rui Barradas Jun 14 '20 at 21:17
  • 2
    Perhaps try using `@` instead of `$` ; if this does not solve it can you try to create a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) please including any library calls. – user20650 Jun 14 '20 at 21:17
  • in your calculation you forgot a 'a' at the end of min(testDat[!!a!!]$amount – Waldi Jun 14 '20 at 21:19

0 Answers0