-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I am encountering an error when I try to consider more than one factor in my function while using aggregate_spectra
Using a slightly modified version of the example for aggregate_spectra
# Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500
# Generate some kind of factor
australia$fact1 <- rep(paste(letters[1:5]), times=20)
australia$fact2 <- sample(LETTERS[1:3], size=100, , replace = TRUE)
#Mean single
m1 <- aggregate_spectra(australia, fun = mean, id = 'fact1')
plot(m1)
m2 <- aggregate_spectra(australia, fun = mean, id = 'fact2')
plot(m2)
#Median combined
m3 <- aggregate_spectra(australia, fun = mean, id = c('fact1','fact2'))
plot(m3)
m1 and m2 are calculated correctly but when trying to calculate m3 this is the resulted output.
Error in FUN(X[[i]], ...) : object 'fact1' not found In addition: Warning messages: 1: In if (id %in% names(features(obj))) { : the condition has length > 1 and only the first element will be used 2: In names(features(obj)) == id : longer object length is not a multiple of shorter object length
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels