# Setup based on Fac_F_RR usage
Fmat <- as.matrix(phytoclass::Fm)
S <- as.matrix(phytoclass::Sm)
cm <- as.numeric(phytoclass:::Bounded_weights(S))
# Get Fmat as a list from NNLS_MF (as used in Fac_F_RR)
Fmat_list <- phytoclass::NNLS_MF(Fmat, S, cm)
# Test with a single index
i <- 1 # first non-zero element to modify
min.scaler <- 0.99
max.scaler <- 1.01
# Run Replace_Rand
result <- phytoclass:::Replace_Rand(Fmat_list, i, S, cm, min.scaler, max.scaler)
Run the code above in your browser using DataLab