Skip to content

Commit

Permalink
🐛 Add check tr nm right order (pb if weights)
Browse files Browse the repository at this point in the history
  • Loading branch information
CmlMagneville committed Feb 26, 2024
1 parent 14d5d3e commit efa6079
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
5 changes: 3 additions & 2 deletions R/check_inputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
}

Expand Down
9 changes: 3 additions & 6 deletions vignettes/mFD_general_workflow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,10 @@ knitr::include_graphics("basic_framework.PNG")
<br />

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:



Expand Down

0 comments on commit efa6079

Please sign in to comment.