discard.individuals: Subsets for objects of class gpData

Description Usage Arguments Value Author(s) See Also Examples

View source: R/discard.markers.r

Description

The function produce subsets from an object of class gpData with reduced individuals. Individual information will be discarded from elements geno, pheno, covar and pedigree.

Usage

1
2
3
4
5
6
discard.individuals(
  gpData,
  which = NULL,
  keepPedigree = FALSE,
  whichNot = NULL
)

Arguments

gpData

object of class gpData

which

character vector identifying names of individuals get discarded from a gpData-object.

keepPedigree

logical. Should the individual only be removed from elements geno and pheno but kept in the pedigree?

whichNot

character vector identifying names of individuals get kept in a gpData-object. Overwrites argument which!

Value

Object of class gpData

Author(s)

Valentin Wimmer and Hans-Juergen Auinger

See Also

create.gpData, add.individuals, add.markers, discard.markers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# example data
set.seed(311)
pheno <- data.frame(Yield = rnorm(10, 200, 5), Height = rnorm(10, 100, 1))
rownames(pheno) <- letters[1:10]
geno <- matrix(sample(c("A", "A/B", "B", NA),
  size = 120, replace = TRUE,
  prob = c(0.6, 0.2, 0.1, 0.1)
), nrow = 10)
rownames(geno) <- letters[1:10]
colnames(geno) <- paste("M", 1:12, sep = "")
# one SNP is not mapped (M5)
map <- data.frame(chr = rep(1:3, each = 4), pos = rep(1:12))
map <- map[-5, ]
rownames(map) <- paste("M", c(1:4, 6:12), sep = "")
gp <- create.gpData(pheno = pheno, geno = geno, map = map)
summary(gp)

# discard genotypes with missing values in the marker matrix
gp3 <- discard.individuals(gp, names(which(rowSums(is.na(gp$geno)) > 0)))
summary(gp3)
## Not run: 
# add one new DH line to maize data
library(synbreedData)
data(maize)

# delete individual
maize2 <- discard.individuals(maize, rownames(maize$geno)[1:10])
summary(maize2)

## End(Not run)

synbreed documentation built on March 12, 2021, 3:01 a.m.