Comments (1)
Reprex:
library(funrar)
trait_df = data.frame(tr1 = c("A", "A", "B", "B"), tr2 = c(rep(0, 3), 1),
tr3 = seq(4, 16, 4))
rownames(trait_df) = letters[1:4]
# Distance Matrix
dist_mat = compute_dist_matrix(trait_df)
small_mat = matrix(c(1, 0, 0, 1), nrow = 2)
colnames(small_mat) = letters[1:2]
rownames(small_mat) = c("s1", "s2")
small_df = matrix_to_stack(small_mat)
# Warning
distinctiveness(small_mat, dist_mat)
#> Distance matrix bigger than site-species matrix
#> Taking subset of distance matrix
#> Warning in distinctiveness(small_mat, dist_mat): Some communities had a single species in them
#> Computed value assigned to 'NaN'
#> a b
#> s1 NaN NA
#> s2 NA NaN
# No warning + computes distinctiveness for absent species
distinctiveness_stack(small_df, "col", "row", "value", dist_mat)
#> More species in distance matrix than in community data.frame
#> Taking subset of distance matrix
#> col row value Di
#> 1 a s1 1 NaN
#> 2 b s1 0 0.1111111
#> 3 a s2 0 0.1111111
#> 4 b s2 1 NaN
Should add tests to expect warnings + undefined distinctiveness for species that are absent.
from funrar.
Related Issues (20)
- Transform to sparse matrices in stack_to_matrix()
- Doc scale 0 and 1
- Warning message when only continuous traits provided in compute_dist_matrix
- Better introductory vignettes
- Create `_tidy()` aliases for `_stack()` functions
- No warning when using `scarcity_stack()` without relative abundances
- Adding argument to disable matrice subsetting
- Add indentation in compute_dist_matrix() message HOT 1
- Alternative distinctiveness definition HOT 1
- Compatibility with `bigmatrix` HOT 1
- Compute Di SAD
- R CMD check fail on CRAN
- Add function to compute global distinctiveness using directly distance matrix HOT 1
- Resolve CRAN compatibility with R 4.0.0 (stringAsFactors = FALSE)
- Update vignette with newest functions
- Correct vignette name typo
- Simplify compatibility with sparse Matrices HOT 1
- Remove reference to relative abundances
- distinctiveness_global() does not put an error when some species are all NAs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from funrar.