Package {BKBreed}


Type: Package
Title: Colourful Biometrical Analysis for Plant Breeding and Genetics
Version: 0.3.2
Description: A compact, colour-first toolkit for the analysis of plant breeding and genetics field experiments. It provides analysis of variance for the randomised block design (RBD) and factorial RBD, a check-anchored intra-block analysis for augmented alpha-lattice designs, and the core biometrical-genetics workflow used in crop improvement: estimation of genetic variability (genotypic and phenotypic coefficients of variation, broad-sense heritability, expected genetic advance), genotypic and phenotypic correlation, path-coefficient analysis, line x tester and Griffing diallel combining-ability analysis (general combining ability and specific combining ability), Mahalanobis D-square genetic-divergence analysis with Tocher and hierarchical clustering, and genotype-by-environment stability analysis (Eberhart-Russell regression and the additive main effects and multiplicative interaction (AMMI) model). Methods follow Griffing (1956) <doi:10.1071/BI9560463> and Eberhart and Russell (1966) <doi:10.2135/cropsci1966.0011183X000600010011x>. Every analysis returns a tidy result object and a publication-ready 'ggplot2' figure using a bespoke high-contrast colour system.
License: GPL-3
Encoding: UTF-8
Depends: R (≥ 4.0.0)
Imports: stats, utils, grDevices, ggplot2
Suggests: ggrepel, patchwork, knitr, rmarkdown, testthat (≥ 3.0.0)
RoxygenNote: 7.3.1
Config/testthat/edition: 3
URL: https://github.com/bkpraveenars-del/BKBreed
BugReports: https://github.com/bkpraveenars-del/BKBreed/issues
NeedsCompilation: no
Packaged: 2026-07-21 11:32:41 UTC; ASUS
Author: Praveen Kumar B. K. [aut, cre]
Maintainer: Praveen Kumar B. K. <bkpraveenars@gmail.com>
Repository: CRAN
Date/Publication: 2026-07-30 16:40:14 UTC

BKBreed: Colourful Biometrical Analysis for Plant Breeding and Genetics

Description

A compact, colour-first toolkit for analysing plant-breeding and genetics field experiments: RBD, Factorial RBD and Augmented Alpha-Lattice designs; genetic variability, correlation and path analysis; Mahalanobis D-square divergence; and Eberhart-Russell / AMMI stability. Every analysis returns a tidy object and a publication-ready ggplot2 figure via bk_plot.

Author(s)

Praveen Kumar B. K. bkpraveenars@gmail.com

See Also

bk_rbd, bk_frbd, bk_augmented, bk_variability, bk_correlation, bk_path, bk_diversity, bk_stability, bk_plot.


Augmented Alpha-Lattice / Augmented RCBD analysis

Description

Analysis of augmented designs. Block effects are estimated by intra-block least squares from replicated checks; every genotype mean is adjusted and classical Federer standard errors are reported.

Usage

bk_augmented(data, trait, gen, block, rep = NULL, checks = NULL, alpha = 0.05)

Arguments

data

A data frame in long format.

trait

Character; response column.

gen

Character; genotype column (checks and test entries).

block

Character; (incomplete) block column.

rep

Character or NULL; replication column for the alpha-lattice layout.

checks

Character vector of check names; if NULL, genotypes occurring more than once are treated as checks.

alpha

Significance level (default 0.05).

Value

An object of class bk_augmented with adjusted means, block effects, error MS and Federer critical differences.

Examples

d <- bk_data("augmented")
res <- bk_augmented(d, "grain_yield", "genotype", "block", "rep",
                    checks = c("CHK-1","CHK-2","CHK-3","CHK-4"))
res
bk_plot(res)

Genotypic and phenotypic correlation

Description

Genotypic and phenotypic correlation coefficients among traits, via analysis of covariance.

Usage

bk_correlation(data, traits, gen, rep)

Arguments

data

A data frame in long format.

traits

Character vector of trait columns (>= 2).

gen

Character; genotype column.

rep

Character; replication column.

Value

An object of class bk_correlation with matrices rg and rp.

Examples

cr <- bk_correlation(bk_data("rbd"),
        c("grain_yield","plant_height","tillers","test_weight"),
        "genotype", "rep")
cr
bk_plot(cr)

Load a bundled BKBreed example dataset

Description

Convenience loader for the demonstration datasets shipped with the package.

Usage

bk_data(name = c("rbd", "frbd", "augmented", "mlt", "lxt", "diallel"))

Arguments

name

One of "rbd", "frbd", "augmented", "mlt", "lxt", "diallel".

Value

A data frame.

Examples

head(bk_data("rbd"))

Griffing diallel combining-ability analysis (Method 2, Model I)

Description

Griffing's (1956) diallel analysis for a half diallel of parents plus one set of F1 crosses without reciprocals (Method 2), with genotypes as fixed effects (Model I). Standard errors are computed exactly by propagating the per-entry error variance through the linear GCA/SCA estimators.

Usage

bk_diallel(data, trait, parent1, parent2, rep, alpha = 0.05)

Arguments

data

A data frame in long format with one row per plot.

trait

Character; response column.

parent1, parent2

Character; the two parent columns of each entry. Diagonal entries (parent1 == parent2) are the parents/selfs.

rep

Character; replication column.

alpha

Significance level for testing effects (default 0.05).

Value

An object of class bk_diallel with the combining-ability ANOVA, parental GCA effects, the SCA matrix, exact standard errors, Baker's predictability ratio and variance components.

See Also

bk_lxt, bk_plot

Examples

res <- bk_diallel(bk_data("diallel"), trait = "grain_yield",
                  parent1 = "parent1", parent2 = "parent2", rep = "rep")
res
bk_plot(res)
bk_plot(res, type = "sca")

Mahalanobis D-square genetic divergence

Description

Computes Mahalanobis D-square distances among genotypes using the pooled error covariance, then groups them by Tocher and Ward clustering.

Usage

bk_diversity(data, traits, gen, rep,
             method = c("tocher", "hierarchical"), clusters = NULL)

Arguments

data

A data frame in long format.

traits

Character vector of trait columns.

gen

Character; genotype column.

rep

Character; replication column.

method

Clustering for the default figure: tocher (default) or hierarchical.

clusters

Number of hierarchical clusters; if NULL, matches the Tocher count.

Value

An object of class bk_diversity with the D2 matrix, cluster memberships and cluster means.

Examples

dv <- bk_diversity(bk_data("rbd"),
        c("grain_yield","plant_height","tillers","test_weight"),
        "genotype", "rep")
dv
bk_plot(dv)

Two-factor Factorial RBD analysis

Description

ANOVA for a two-factor factorial in a randomised block design, with main-effect and interaction means and factor-specific critical differences.

Usage

bk_frbd(data, trait, factorA, factorB, rep, alpha = 0.05)

Arguments

data

A data frame in long format.

trait

Character; response column.

factorA, factorB

Character; the two treatment factor columns.

rep

Character; replication/block column.

alpha

Significance level (default 0.05).

Value

An object of class bk_frbd.

Examples

res <- bk_frbd(bk_data("frbd"), "grain_yield", "nitrogen", "variety", "rep")
res
bk_plot(res)

Line x Tester combining-ability analysis

Description

Kempthorne's Line x Tester analysis for l \times t crosses in a randomised block design. Partitions crosses into lines, testers and line x tester; estimates GCA and SCA effects; and derives additive and dominance variances (assuming inbred parents, F = 1).

Usage

bk_lxt(data, trait, line, tester, rep, alpha = 0.05)

Arguments

data

A data frame of the crosses in long format.

trait

Character; response column.

line

Character; line (female) column.

tester

Character; tester (male) column.

rep

Character; replication column.

alpha

Significance level for testing GCA/SCA effects (default 0.05).

Value

An object of class bk_lxt with the combining-ability ANOVA, GCA effects for lines and testers, SCA effects, proportional contributions and variance components.

See Also

bk_plot

Examples

res <- bk_lxt(bk_data("lxt"), trait = "grain_yield",
              line = "line", tester = "tester", rep = "rep")
res
bk_plot(res)
bk_plot(res, type = "sca")

BKBreed colour palettes

Description

A curated set of high-contrast palettes used across all BKBreed figures.

Usage

bk_palette(name = c("field", "spectrum", "canopy", "sunrise", "earth"),
          n = NULL, reverse = FALSE)

Arguments

name

Palette name.

n

Number of colours to return (interpolated if needed).

reverse

Logical; reverse the palette order.

Value

A character vector of hex colours.

Examples

bk_palette("sunrise", 5)
bk_palette("spectrum", 11)

Path-coefficient analysis

Description

Partitions the correlation of each causal trait with a target trait into direct and indirect effects (Wright's path analysis).

Usage

bk_path(data, traits, dependent, gen, rep, type = c("genotypic", "phenotypic"))

Arguments

data

A data frame in long format.

traits

Character vector of causal (independent) traits.

dependent

Character; the target/effect trait.

gen

Character; genotype column.

rep

Character; replication column.

type

Correlation basis: genotypic (default) or phenotypic.

Value

An object of class bk_path with direct/indirect effects and the residual.

Examples

pa <- bk_path(bk_data("rbd"),
        c("plant_height","tillers","panicle_len","test_weight"),
        "grain_yield", "genotype", "rep")
pa
bk_plot(pa)

Draw the signature figure for a BKBreed result

Description

Generic entry point returning the publication-ready figure for whichever analysis produced x.

Usage

bk_plot(x, ...)

Arguments

x

A BKBreed result object.

...

Passed to the specific method (e.g. type for stability and correlation).

Value

A ggplot2 object.

Examples

bk_plot(bk_rbd(bk_data("rbd"), "grain_yield", "genotype", "rep"))

Randomised Block Design (RBD) analysis

Description

One-call ANOVA for a randomised complete block design with SE, critical difference, CV and compact-letter groupings.

Usage

bk_rbd(data, trait, gen, rep, alpha = 0.05)

Arguments

data

A data frame in long format.

trait

Character; response column.

gen

Character; genotype/treatment column.

rep

Character; replication/block column.

alpha

Significance level for the critical difference (default 0.05).

Value

An object of class bk_rbd with elements anova, means, cv, sem, sed and cd.

See Also

bk_plot, bk_frbd

Examples

res <- bk_rbd(bk_data("rbd"), "grain_yield", "genotype", "rep")
res
bk_plot(res)

GxE stability analysis (Eberhart-Russell + AMMI)

Description

Multi-location trial analysis: combined ANOVA, Eberhart-Russell regression (bi, S2di) and an AMMI decomposition with IPCA scores for biplots.

Usage

bk_stability(data, trait, gen, env, rep)

Arguments

data

A data frame in long format.

trait

Character; response column.

gen

Character; genotype column.

env

Character; environment/location column.

rep

Character; replication column.

Value

An object of class bk_stability with combined ANOVA, Eberhart-Russell parameters and AMMI scores.

Examples

st <- bk_stability(bk_data("mlt"), "grain_yield",
                   "genotype", "environment", "rep")
st
bk_plot(st)
bk_plot(st, type = "er")

Genetic variability parameters

Description

Estimates GCV, PCV, ECV, broad-sense heritability, genetic advance and genetic advance as percent of mean for one or more traits.

Usage

bk_variability(data, traits, gen, rep, k = 2.063)

Arguments

data

A data frame in long format.

traits

Character vector of trait columns.

gen

Character; genotype column.

rep

Character; replication column.

k

Selection differential (default 2.063 for 5 percent intensity).

Value

An object of class bk_variability (a data frame with metadata).

Examples

v <- bk_variability(bk_data("rbd"),
       c("grain_yield","plant_height","tillers","test_weight"),
       "genotype", "rep")
v
bk_plot(v)

Discrete BKBreed colour and fill scales

Description

Discrete colour and fill scales built on the BKBreed palettes.

Usage

scale_colour_bk(pal_name = "sunrise", reverse = FALSE, ...)

scale_color_bk(pal_name = "sunrise", reverse = FALSE, ...)

scale_fill_bk(pal_name = "sunrise", reverse = FALSE, ...)

Arguments

pal_name

BKBreed palette name (see bk_palette).

reverse

Logical; reverse the palette.

...

Passed to ggplot2::discrete_scale (e.g. name for the legend title).

Value

A ggplot2 scale.

Examples

library(ggplot2)
ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) +
  geom_point() + scale_colour_bk("sunrise")

A clean, high-contrast ggplot2 theme

Description

The BKBreed figure theme.

Usage

theme_bk(base_size = 12, base_family = "", grid = TRUE)

Arguments

base_size

Base font size in points.

base_family

Font family.

grid

Logical; draw light major grid lines.

Value

A ggplot2 theme object.

Examples

library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_bk()