4747# ' @param bin_num Integer. Specifies the number of bins for the histogram. It is generally recommended
4848# ' to use the default value of 650. Adjusting \code{bin_width} is often more effective than changing
4949# ' \code{bin_num}.
50- # ' @param drop_features Integer vector. Completely remove the RS variable from the histogram generation. For
51- # ' consistency, it is recommended to exclude the same variables later in the benchmarking step; unless
52- # ' you have a specific reason not to.
50+ # ' @param drop_features Integer vector of remote sensing variable IDs . Completely remove the RS variable
51+ # ' from the histogram generation. For consistency, it is recommended to exclude the same variables later
52+ # ' in the benchmarking step; unless you have a specific reason not to.
5353# ' @param num_threads Integer. Specifies the number of CPU threads to be used for processing. A value
5454# ' below 1 indicates that all available threads will be utilized (default). Refer to the details section for
5555# ' more information.
@@ -105,10 +105,10 @@ histogram <- function(
105105
106106
107107 # number of observed RS vars
108- num_layers <- (ncol(data_vals ) - 2 ) / 2
108+ n_vars <- (ncol(data_vals ) - 2 ) / 2
109109 # id of obs and mod for saving
110- mod_layers <- seq_len(num_layers ) + 2
111- obs_layers <- mod_layers + num_layers
110+ mod_layers <- seq_len(n_vars ) + 2
111+ obs_layers <- mod_layers + n_vars
112112
113113 # get the correct columns for the C++ code
114114 samples_xy <- data_vals [, 1 : 2 ]
@@ -133,6 +133,9 @@ histogram <- function(
133133
134134 # drop features from calculation if requested
135135 if (length(drop_features )) {
136+ if (any(drop_features > n_vars )) {
137+ stop(" The feature IDs in drop_features must not be larger than the number of remote sensing variables." )
138+ }
136139 observed [, drop_features ] <- 0
137140 modelled [, drop_features ] <- 0
138141 }
0 commit comments