# NOT RUN {
## help("scale,db.obj-method") # display this doc
<!-- %% @test .port Database port number -->
<!-- %% @test .dbname Database name -->
## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname)
x <- as.db.data.frame(abalone, conn.id = cid)
lk(x, 10)
s <- scale(x[-c(1,2)]) # scale all numeric columns
centers <- attr(s, "scaled:center")
scales <- attr(s, "scaled:scale")
## create the scaled table
delete("scaled_abalone")
y <- as.db.data.frame(s, "scaled_abalone")
lk(y, 10)
db.disconnect(cid, verbose = FALSE)
# }
Run the code above in your browser using DataLab