Skip to content

Commit 6b9baf7

Browse files
committed
Add synthetic maize data, docs and data-raw
Add synthetic phenotype and genotype example data for the selection.index package: maize_pheno and maize_geno (.rda) plus a data-raw/maize.R script that generates them (uses usethis::use_data). Consolidate dataset documentation into R/data.R (roxygen) and add generated man pages for maize_pheno and maize_geno. Remove legacy R/seldata.R and R/weight.R (docs for seldata and weight updated to point to R/data.R). Also include compiled native build artifacts in src (RcppExports.o, math_primitives.o, selection.index.dll). These changes provide reproducible example datasets and updated documentation for examples/tests.
1 parent 05e2024 commit 6b9baf7

13 files changed

Lines changed: 187 additions & 37 deletions

R/data.R

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# R/data.R
2+
3+
#' Synthetic Maize Phenotypic Data
4+
#'
5+
#' A synthetic dataset containing multi-environment phenotypic records for 100
6+
#' maize genotypes. Designed to demonstrate phenotypic selection index
7+
#' calculations and variance-covariance matrix estimations.
8+
#'
9+
#' @name maize_pheno
10+
#' @docType data
11+
#' @format A data frame with 600 rows and 6 variables:
12+
#' \describe{
13+
#' \item{Genotype}{Factor representing 100 unique maize genotypes.}
14+
#' \item{Environment}{Factor representing 2 distinct growing environments.}
15+
#' \item{Block}{Factor representing 3 replicate blocks within each environment.}
16+
#' \item{Yield}{Numeric vector of grain yield in kg/ha.}
17+
#' \item{PlantHeight}{Numeric vector of plant height in centimeters.}
18+
#' \item{DaysToMaturity}{Numeric vector of days to physiological maturity.}
19+
#' }
20+
#' @source Simulated for the selection.index package to provide reproducible examples.
21+
#' @usage data(maize_pheno)
22+
#' @keywords datasets
23+
#' @examples
24+
#' data(maize_pheno)
25+
#' head(maize_pheno)
26+
NULL
27+
28+
#' Synthetic Maize Genomic Data
29+
#'
30+
#' A synthetic dataset containing Single Nucleotide Polymorphism (SNP) marker
31+
#' data for the 100 maize genotypes found in maize_pheno. Designed for
32+
#' testing genomic selection indices (GESIM/RGESIM) and relationship matrices.
33+
#'
34+
#' @name maize_geno
35+
#' @docType data
36+
#' @format A numeric matrix with 100 rows (genotypes) and 500 columns (SNP markers):
37+
#' \describe{
38+
#' \item{Rows}{100 genotypes, matching the Genotype column in maize_pheno.}
39+
#' \item{Columns}{500 simulated SNP markers, coded as 0, 1, or 2.}
40+
#' }
41+
#' @source Simulated for the selection.index package to provide reproducible examples.
42+
#' @usage data(maize_geno)
43+
#' @keywords datasets
44+
#' @examples
45+
#' data(maize_geno)
46+
#' dim(maize_geno)
47+
NULL
48+
49+
#' Selection Index DataSet
50+
#'
51+
#' A dataset containing the data of three replications and 48 progenies
52+
#' with 7 different traits.
53+
#'
54+
#' \itemize{
55+
#' \item rep. Replications
56+
#' \item treat. Treatments/Genotypes
57+
#' \item sypp. Seed Yield per Plant
58+
#' \item dtf. Days to 50% Flowering
59+
#' \item rpp. Racemes per Plant
60+
#' \item ppr. Pods per Raceme
61+
#' \item ppp. Pods per Plant
62+
#' \item spp. Seeds per Pod
63+
#' \item pw. Pods Weight
64+
#' }
65+
#' @docType data
66+
#' @name seldata
67+
#' @usage data(seldata)
68+
#' @format A data frame with 75 rows and 9 columns
69+
NULL
70+
71+
#' Weight dataset
72+
#'
73+
#' A dataset containing the data of 2 different weights namely euqal weight and
74+
#' broad sense heritability
75+
#'
76+
#' \itemize{
77+
#' \item EW. Equal Weight
78+
#' \item h2. Broad Sense Heritability
79+
#' }
80+
#' @docType data
81+
#' @name weight
82+
#' @usage data(weight)
83+
#' @format A data frame with 7 rows and 3 columns
84+
NULL

R/seldata.R

Lines changed: 0 additions & 21 deletions
This file was deleted.

R/weight.R

Lines changed: 0 additions & 14 deletions
This file was deleted.

data-raw/maize.R

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# data-raw/maize.R
2+
# Generate synthetic maize data for the selection.index package
3+
4+
set.seed(2026)
5+
6+
# 1. Phenotypic Data (maize_pheno)
7+
# Simulating 100 genotypes across 2 environments and 3 blocks for 3 traits
8+
n_genotypes <- 100
9+
n_env <- 2
10+
n_blocks <- 3
11+
12+
maize_pheno <- expand.grid(
13+
Genotype = paste0("G", sprintf("%03d", 1:n_genotypes)),
14+
Environment = paste0("Env", 1:n_env),
15+
Block = paste0("B", 1:n_blocks)
16+
)
17+
18+
# Simulate traits with some correlation
19+
base_yield <- rnorm(nrow(maize_pheno), mean = 8000, sd = 500)
20+
base_height <- base_yield * 0.02 + rnorm(nrow(maize_pheno), mean = 50, sd = 10)
21+
base_maturity <- 120 - (base_yield * 0.001) + rnorm(nrow(maize_pheno), mean = 5, sd = 2)
22+
23+
maize_pheno$Yield <- round(base_yield, 2)
24+
maize_pheno$PlantHeight <- round(base_height, 2)
25+
maize_pheno$DaysToMaturity <- round(base_maturity, 0)
26+
27+
# 2. Genomic Data (maize_geno)
28+
# Simulating a matrix of 100 genotypes x 500 SNP markers (coded 0, 1, 2)
29+
n_markers <- 500
30+
maize_geno <- matrix(
31+
sample(0:2, n_genotypes * n_markers, replace = TRUE, prob = c(0.25, 0.5, 0.25)),
32+
nrow = n_genotypes,
33+
ncol = n_markers
34+
)
35+
rownames(maize_geno) <- paste0("G", sprintf("%03d", 1:n_genotypes))
36+
colnames(maize_geno) <- paste0("SNP_", sprintf("%03d", 1:n_markers))
37+
38+
# Save the generated data to the data/ directory
39+
usethis::use_data(maize_pheno, maize_geno, overwrite = TRUE)

data/maize_geno.rda

12.9 KB
Binary file not shown.

data/maize_pheno.rda

5.43 KB
Binary file not shown.

man/maize_geno.Rd

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/maize_pheno.Rd

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/seldata.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/weight.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)