Comments (3)
@DannyLBuss I started editing this function, and perhaps got carried away. I hope it's a bit simpler now, but let me know what you think.
I changed the functionality to return a mean of mean matFs instead of a random matF, and I also changed it to return a meanMatF for every single row of the database that gets passed, rather than for only a subset of "Individual" matrices. I figure the user can subset to "Individual" at a later point, if they so wish. Let me know what you think, and/or if you prefer the original function.
(Also, I changed the name to appendMeanMatF)
from rcompadre.
I propose dropping the meanMatF
function in favour of a more general function that takes a list of matrices (of equal dimension) and returns the element-wise mean matrix (e.g. averageMats
).
The problem I see with meanMatF
is that there are many different grouping levels at which a user might want to calculate a mean matrix, depending on the analysis, e.g.
SpeciesAuthor
xMatrixPopulation
SpeciesAuthor
xMatrixPopulation
xMatrixTreatment
SpeciesAuthor
xMatrixStartYear
SpeciesAuthor
xMatrixStartYear
x<user-derived column>
There's also the complication of how to deal with matrix dimension mismatch, if it pops up at the desired level. I think making meanMatF
sufficiently flexible would also make it overly complicated.
With the tidy version of db (#27) and a function like averageMats
, it would be easier for a user to average any type of matrix at any given group level with their own 'split-apply-combine' operation, e.g.
db %>%
group_by(SpeciesAuthor, MatrixDimension) %>%
mutate(matF_mean = averageMats(matF)) %>%
ungroup()
I suggest we replace meanMatF
with averageMats
, and add an example like this to the vignette (or website, etc.).
(Side note: popbio
has a mean.list
S3 method that does the same thing as averageMats
, but I think it would be preferable to have a separate standalone function).
from rcompadre.
cdb_mean_matF
and mpm_mean
can be used to produce mean fecundity matrices. My issues from the previous comment are resolved by #48, so closing this.
from rcompadre.
Related Issues (20)
- Add a function to output a Matlab compatible data file
- Function to load local com(p)adre .Rdata files HOT 3
- Change name of matrixClass to MatrixClass for consistency HOT 4
- Check that Rcompadre works well with the old database versions HOT 1
- Add method for droplevels
- Add function to create CompadreDB object from matrices and metadata. HOT 2
- Write vignette to illustrate `cdb_build_cdb` functionality HOT 1
- cdb_rbind - allow binding of COMPADRE objects with different metadata.
- mat_to_string fails when whole matrix is NA HOT 1
- filter error when compiling vignette. Error in storage.mode(x) <- "double" :
- Improve vignette to illustrate cdb_build_cdb functionality
- Add argument to cdb_fetch to automatically add error flag columns HOT 1
- Add vignette with NO piping HOT 1
- Add unit tests to cdb_build_cdb
- Standardize case convention on database column names HOT 1
- add methods for CompadreDB objects or supress helper text HOT 2
- suggestion for additional calculations across matrices: mat_sd and mat_median HOT 2
- 2 small taxonomic inconsistencies for crocodiles and turtles? HOT 1
- cdb_rbind improvement
- popbio should be popdemo 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 rcompadre.