Created
January 4, 2018 14:15
-
-
Save philipp-baumann/11860c452e3896665259a5903e8d452b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
## Task: Select reference samples for soil refence analyses by using | |
## Kennard-Stones | |
## sampling algorithm on preprocessed spectra in PCA space | |
################################################################################ | |
# Load packages | |
library("tidyverse") | |
library("simplerspec") | |
# Read spectral tibble from Rds file | |
spc_tbl <- read_rds(path = "out/files/spc_tbl.Rds") | |
ref_samples_2pc <- select_ref_spc( | |
spc_tbl = spc_tbl, | |
ratio_ref = 0.15, # ratio of desired reference samples to total sample number | |
pc = 2, # Number of principal components considered | |
print = TRUE) # print plot of PCA space | |
# Test 6 PCs | |
ref_samples_6pc <- select_ref_spc( | |
spc_tbl = spc_tbl, | |
ratio_ref = 0.15, # ratio of desired reference samples to total sample number | |
pc = 6, # Number of principal components considered | |
print = TRUE) | |
## Compare if different samples have been chosen... | |
ref_samples_2pc$spc_ref$sample_id | |
ref_samples_6pc$spc_ref$sample_id | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment