selindrix
To construct the selection index for multi-trait selection of animals
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.6%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
To construct the selection index for multi-trait selection of animals
Basic Info
- Host: GitHub
- Owner: venkatesanraja
- License: other
- Language: R
- Default Branch: main
- Size: 338 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Created over 1 year ago
· Last pushed about 1 year ago
Metadata Files
Readme
License
README.Rmd
---
output: github_document
title: "seliNDRIx: Your Package Description Here"
---
buld+_b---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# seliNDRIx
The goal of seliNDRIx is to construct the selection index from the animal breeding data using the mixed and random sire models.
## Installation
You can install the development version of seliNDRIx like so:
``` r
# FILL THIS IN! HOW CAN PEOPLE INSTALL YOUR DEV PACKAGE?
install.packages("seliNDRIx")
require(seliNDRIx)
## Example
This is a basic example which shows you how to solve a common problem:
library(seliNDRIx)
# Example using mixed function
# Read the data
data("data", package = "seliNDRIx")
# Define your parameters
traits <- c("tmy", "py", "fatyield")
fixed <- c("farm", "soc", "poc")
random <- c("sire")
economic_values <- c(1, 0.85, 0.65)
# Run the analysis
results <- mixed_si(
data = data,
traits = traits,
fixed = fixed,
random = random,
economic_values = economic_values
)
results
# To calculate the overall selection index for each animal
SI <- c(results$SelectionIndex) # Selection index estimates (weights) for traits
traits <- c("tmy", "py", "fatyield") # Define the trait columns to use
overall_index <- function(data, SI, traits) {
# Ensure the number of weights matches the number of trait columns
if (length(SI) != length(traits)) {
stop("The number of weights must match the number of trait columns.")
}
# Select only the defined trait columns and calculate the index
data %>%
rowwise() %>%
mutate(Index = sum(c_across(all_of(traits)) * SI)) %>%
ungroup()
}
# Calculate the selection index
result3 <- overall_index(data, SI, traits)
# Print the result
print(result3)
# Select the top 20% of animals with the highest selection index values
top20 <- result3 %>%
arrange(desc(Index)) %>% # Sort by Index in descending order
slice_head(prop = 0.2) # Select the top 20%
write.csv(top20, "D:/Top20.csv", row.names = FALSE)
# Example using random function
# Read the data
data("data", package = "seliNDRIx")
# Run the analysis
results2 <- random_si(data,
traits = c("tmy", "py", "fatyield"),
economic_values = c(1, 0.85, 0.65))
results2
# To calculate the overall selection index for each animal
SI <- c(results$SelectionIndex) # Selection index estimates (weights) for traits
traits <- c("tmy", "py", "fatyield") # Define the trait columns to use
overall_index <- function(data, SI, traits) {
# Ensure the number of weights matches the number of trait columns
if (length(SI) != length(traits)) {
stop("The number of weights must match the number of trait columns.")
}
# Select only the defined trait columns and calculate the index
data %>%
rowwise() %>%
mutate(Index = sum(c_across(all_of(traits)) * SI)) %>%
ungroup()
}
# Calculate the selection index
result3 <- overall_index(data, SI, traits)
# Print the result
print(result3)
# Select the top 20% of animals with the highest selection index values
top20 <- result3 %>%
arrange(desc(Index)) %>% # Sort by Index in descending order
slice_head(prop = 0.2) # Select the top 20%
write.csv(top20, "D:/Top20.csv", row.names = FALSE)
What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so:
You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this.
You can also embed plots, for example:
In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN.
Owner
- Login: venkatesanraja
- Kind: user
- Repositories: 1
- Profile: https://github.com/venkatesanraja
GitHub Events
Total
- Push event: 76
- Create event: 6
Last Year
- Push event: 76
- Create event: 6
Packages
- Total packages: 1
-
Total downloads:
- cran 162 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
cran.r-project.org: seliNDRIx
Construction of Selection Index
- Homepage: https://github.com/venkatesanraja/seliNDRIx
- Documentation: http://cran.r-project.org/web/packages/seliNDRIx/seliNDRIx.pdf
- License: MIT + file LICENSE
-
Latest release: 0.1.2
published about 1 year ago
Rankings
Dependent packages count: 26.6%
Dependent repos count: 32.7%
Average: 48.6%
Downloads: 86.6%
Maintainers (1)
Last synced:
10 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.5 depends
- dplyr * imports
- psych * imports
- testthat >= 3.0.0 suggests