View source: R/outliermethods.R
| xknn | R Documentation |
k-nearest neighbors for outlier detection
xknn(
data,
output,
exclude = NULL,
metric = "manhattan",
mode = "soft",
pc = FALSE,
boot = FALSE,
var,
pcvar = NULL
)
data |
Data frame of species records with environmental data. |
output |
Either clean: for data frame with no suspicious outliers or outlier: to return dataframe with only outliers. |
exclude |
Exclude variables that should not be considered in the fitting the one class model, for example x and y columns or latitude/longitude or any column that the user doesn't want to consider. |
metric |
The different metric distances to compute the distances among the environmental predictors. See |
mode |
This includes |
pc |
Whether principal component analysis will be computed. Default |
boot |
Whether bootstrapping will be computed. Default |
var |
The variable of concern, which is vital for univariate outlier detection methods |
pcvar |
Principal component analysis to e used for outlier detection after PCA. Default |
Dataframe with or with no outliers.
data("efidata")
danube <- system.file('extdata/danube.shp.zip', package='specleanr')
db <- sf::st_read(danube, quiet=TRUE)
wcd <- terra::rast(system.file('extdata/worldclim.tiff', package='specleanr'))
refdata <- pred_extract(data = efidata, raster= wcd ,
lat = 'decimalLatitude',
lon= 'decimalLongitude',
colsp = "scientificName",
bbox = db,
minpts = 10)
lofout <- xknn(data = refdata[["Thymallus thymallus"]], exclude = c("x", "y"),
output='outlier', metric ='manhattan',
mode = "soft")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.