Learn R Programming

synbreed (version 0.12-9)

add.markers: Add new markers to an object of class gpData

Description

This function adds new markers to the element geno of an object of class gpData and updates the marker map.

Usage

add.markers(gpData, geno, map)

Arguments

gpData

object of class gpData to be updated

geno

matrix with new columns

map

data.frame with columns 'chr' and 'pos' for new markers

Value

object of class gpData with new markers

Details

rownames in argument geno must match rownames in the element geno object of class gpData.

See Also

add.individuals, discard.markers

Examples

Run this code
# NOT RUN {
# creating gpData object
# phenotypic data
pheno <- data.frame(Yield = rnorm(10,100,5), Height = rnorm(10,10,1))
rownames(pheno) <- 1:10
# genotypic data
geno <- matrix(sample(c(1,0,2,NA),size=120,replace=TRUE,
prob=c(0.6,0.2,0.1,0.1)),nrow=10)
rownames(geno) <-  1:10
# genetic map
map <- data.frame(chr=rep(1:3,each=4),pos=rep(1:12))
colnames(geno) <- rownames(map) <-  paste("M",1:12,sep="")
# as gpData object
gp <- create.gpData(pheno,geno,map)


# new data
geno2 <- matrix(c(0,0,1,1,1,2,2,1,1,2,1,2,0,2,1,1,1,2,2,2),ncol=2)
rownames(geno2) <- 1:10
map2 <- data.frame(pos=c(0.3,5),chr=c(1,2))
rownames(map2) <- colnames(geno2) <- c("M13","M14")

# adding new markers
gp2 <- add.markers(gp,geno2,map2)
summary(gp2)
summary(gp)
                                                                                       
# }

Run the code above in your browser using DataLab