diff --git a/NEWS.md b/NEWS.md index d69f974..996d7bb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,7 @@ # mFD (development version) +* Traits names in the tr_cat dataframe must be the same that in the sp_tr +dataframe: otherwise can lead to bugs if using weights: check.sp.tr() +* Add a sentence explaining that in the General Workflow vignette # mFD 1.0.6 * Fix bug: diff --git a/R/check_inputs.R b/R/check_inputs.R index b575777..7583f56 100644 --- a/R/check_inputs.R +++ b/R/check_inputs.R @@ -113,9 +113,10 @@ check.sp.tr <- function(sp_tr, tr_cat = NULL, stop_if_NA = TRUE) { "traits x category data frame. Please check.") } - if (any(sort(names(sp_tr)) != sort(tr_cat$"trait_name"))) { + if (any(names(sp_tr) != tr_cat$"trait_name")) { stop("Trait names differ between species x traits data frame and ", - "traits x category data frame. Please check.") + "traits x category data frame or are not in the ame order. + Please check.") } } diff --git a/vignettes/mFD_general_workflow.Rmd b/vignettes/mFD_general_workflow.Rmd index 5087ea6..ad05969 100644 --- a/vignettes/mFD_general_workflow.Rmd +++ b/vignettes/mFD_general_workflow.Rmd @@ -106,13 +106,10 @@ knitr::include_graphics("basic_framework.PNG")
The first thing to do before starting analyses is to know your data. To do so, -you must be able to characterize the traits you are using (*i.e.* tell the -package what type of traits you are using). That is why `mFD` package needs a -data frame summarizing the type of each trait (*i.e.* each column of the -`fruits_traits` data frame). +you must be able to characterize the traits you are using (*i.e.* tell the package what type of traits you are using). That is why `mFD` package needs a data frame summarizing the type of each trait (*i.e.* each column of the `fruits_traits` data frame). -**NB** You need to set up a data frame with the same columns names as the below -example: +**NB** You need to set up a data frame with the same columns names as the below example and traits names need to be in the same order as in +the `fruits_traits` data frame: