Description Usage Arguments Details Value Author(s) Examples
More details of k Nearest Neighbours are available in the documentation of knn
.
1 2 3 4 5 6 | ## S4 method for signature 'matrix'
kNNinterface(measurements, classes, test, ...)
## S4 method for signature 'DataFrame'
kNNinterface(measurements, classes, test, ..., verbose = 3)
## S4 method for signature 'MultiAssayExperiment'
kNNinterface(measurements, test, targets = names(measurements), ...)
|
measurements |
Either a |
classes |
Either a vector of class labels of class |
test |
An object of the same class as |
targets |
If |
... |
Variables not used by the |
verbose |
Default: 3. A number between 0 and 3 for the amount of progress messages to give. This function only prints progress messages if the value is 3. |
Data tables which consist entirely of non-numeric data cannot be analysed. If measurements
is an object of class MultiAssayExperiment
, the factor of sample classes must be stored
in the DataFrame accessible by the colData
function with column name "class"
.
A factor vector, the same as is returned by knn
.
Dario Strbenac
1 2 3 4 5 6 7 8 9 10 | if(require(class))
{
classes <- factor(rep(c("Healthy", "Disease"), each = 5),
levels = c("Healthy", "Disease"))
measurements <- matrix(c(rnorm(50, 10), rnorm(50, 5)), ncol = 10)
colnames(measurements) <- paste("Sample", 1:10)
rownames(measurements) <- paste("mRNA", 1:10)
}
kNNinterface(measurements[, 1:9], classes[1:9], measurements[, 10, drop = FALSE])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.