jonesor / Rcompadre

R tools for obtaining and manupulating data from the COMPADRE and COMADRE Plant and Animal Matrix Databases
https://jonesor.github.io/Rcompadre/
11 stars 12 forks source link

filter error when compiling vignette. Error in storage.mode(x) <- "double" : #122

Open jonesor opened 3 years ago

jonesor commented 3 years ago

When compiling a03_VectorisingRcompadre.Rmd I get an error when using filter (but not if I replace with subset)

Error in storage.mode(x) <- "double" : 
  no method for coercing this S4 class to a vector
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> filter

Why doesn't filter work for this?

The relevant chunk of code:

# add column 'check_NA_A', indicating whether matA contains missing values (T/F)
CompFlag <- cdb_flag(CompUnnest, checks = "check_NA_A")

# remove rows where matA contains missing values
CompSub <- subset(CompFlag, check_NA_A == FALSE)

# apply lambda() to every remaining matA
CompSub$lambda <- sapply(matA(CompSub), popdemo::eigs, what = "lambda")