Description Usage Arguments Value Author(s) See Also Examples
View source: R/interpolate.classes.R
This function interpolates grain-size data for different classes, either to higher or to lower resolution.
1 2 3 4 5 6 7 | interpolate.classes(
X,
boundaries.in,
boundaries.out,
method = "natural",
fixed.start = TRUE
)
|
X |
|
boundaries.in |
|
boundaries.out |
|
method |
|
fixed.start |
|
Numeric
matrix, interpolated class values.
Michael Dietze, Elisabeth Dietze
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## load example data
data(example_X)
classes.in <- seq(from = 1, to = 10, length.out = ncol(X))
## Example 1 - decrease the class numbers
## define number of output classes
classes.out <- seq(1, 10, length.out = 20)
## interpolate the data set
Y <- interpolate.classes(X = X,
boundaries.in = classes.in,
boundaries.out = classes.out,
method = "linear")
## show original vs. interpolation for first 10 samples
plot(NA, xlim = c(1, 10), ylim = c(0, 40))
for(i in 1:10) {
lines(classes.in, X[i,] * 20 + i)
lines(classes.out, Y[i,] * 20 + i, col = 2)
}
## Example 2 - increase the class numbers
## define number of output classes
classes.out <- seq(1, 10, length.out = 200)
## interpolate the data set
Y <- interpolate.classes(X = X,
boundaries.in = classes.in,
boundaries.out = classes.out)
## show original vs. interpolation for first 10 samples
plot(NA, xlim = c(1, 10), ylim = c(0, 40))
for(i in 1:10) {
lines(classes.in, X[i,] * 20 + i)
lines(classes.out, Y[i,] * 20 + i, col = 2)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.