heritability_n_blues: Compute heritability and genotypic BLUEs for each selected...

Description Usage Arguments Value Note Examples

View source: R/trait_genetics_tidy.R

Description

Compute heritability and genotypic BLUEs for each selected grouping variable adjusting for covariate.

Usage

1
2
3
4
5
6
7
8
9
heritability_n_blues(
  df,
  grouping_var,
  grouping_items_sel,
  dependent_var,
  covariate = NULL,
  genotype_var,
  replication_var
)

Arguments

df

A dataframe or similar object of coercible class.

grouping_var

Column name of the grouping variable such as location or environment of character or factor type.

grouping_items_sel

A character vector of items which are subset of grouping variable selected for obtaining heritability.

dependent_var

Column name of response variable whose heritability estimates are being obtained through model.

covariate

Column name of numeric variable. Adjusted values of dependent variable for this covariate will be used in obtaining estimates.

replication_var

Column name of variable representing replicated records of genotypes/treatments.

genotype

Column name of variable representing genotypes/treatments.

Value

A list

Note

Adapted from 'meta-r' application package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(lme4)
library(emmeans)
require(tidyverse)
# load data
df <- expdean::simple_rcbd_df
df <- mutate_at(df, c("Genotype", "Rep"), as.factor)
# check for factor levels
df %>%
  select_if(list(~is.factor(.)|is.character(.))) %>%
  map_int(~length(unique(.x)))
# calculate genetic correlation for locations in absence of other grouping factors while adjusting for covariate
heritability_n_blues(df, grouping_items_sel = c("Buenos Aires", "Beijin", "Karaj"),
                     grouping_var = Location,
                     genotype = Genotype, replication_var = Rep,
                     dependent_var = YLD, covariate = TGW)

DeependraD/expdean documentation built on Nov. 25, 2019, 12:33 a.m.