# NOT RUN {
set.seed(120)
x <- matrix(rnorm(1000*20), ncol=20)
y <- sample(c(1:4), size=20, replace=TRUE)
# for original pam
mydata <- list(x=x, y=y)
mytraindata <- list(x=x[,1:15],y=factor(y[1:15]))
mytestdata <- list(x = x[,16:20], y = factor(y[16:20]))
# for formula-based methods including pamrML
alldf <- cbind.data.frame(t(mydata$x), y)
traindf <- cbind.data.frame(t(mytraindata$x), y = mytraindata$y)
testdf <- cbind.data.frame(t(mytestdata$x), y = mytestdata$y)
### create pamrML object
pamrMLObj <- pamrML(y ~ ., traindf)
pamrMLObj
### test predict method
predict(object = pamrMLObj, newdata = testdf,
threshold = 1) # threshold compulsory
# }
Run the code above in your browser using DataLab