# NOT RUN {
# this example creates distances for the built in mtcars data
# see ?mtcars for more details
# The distances are calculated from the "best" in the dataset
# First we create an appropriate CompositeData class object
# higher mpg & hp are better and lower wt & qsec are better
d <- CompositeData(mtcars[, c("mpg", "hp", "wt", "qsec")],
thresholds = list(one = with(mtcars, c(
mpg = max(mpg),
hp = max(hp),
wt = min(wt),
qsec = min(qsec)))
),
higherisbetter = c(TRUE, TRUE, FALSE, FALSE),
rawtrans = list(
mpg = function(x) x,
hp = function(x) x,
wt = function(x) x,
qsec = sqrt))
# create the distance scores
dres <- prepareComposite(d)
# see a density plot of the distance scores
dres@distanceDensity
# regular summary of distance scores
summary(dres@distances)
# examine covariance matrix
round(dres@covmat,2)
# cleanup
rm(d, dres)
# }
Run the code above in your browser using DataLab