Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using multiple ids with aggregate_spectra function #2

Open
FedeMassetti opened this issue Aug 20, 2018 · 0 comments
Open

Problems using multiple ids with aggregate_spectra function #2

FedeMassetti opened this issue Aug 20, 2018 · 0 comments

Comments

@FedeMassetti
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant