require(GenABEL.data)
data(srdta)
# take a small subset for this example
srdta <- srdta[1:10,1:5]
srdta
# add single var
rnd <- rnorm(nids(srdta))
srdta1 <- add.phdata(srdta,rnd,name="random")
srdta1
# add > 1 var
# generate id names
ids <- paste("p",c(2,1,7,3,5,9,11,22,27),sep="")
# generate some random trait values
newtra1 <- rnorm(9)
newtra2 <- rnorm(9)
# make data frame
x <- data.frame(id=ids,newtra1=newtra1,newtra2=newtra2)
x
# now add this new trait to the data
srdta1 <- add.phdata(srdta,x)
srdta1
Run the code above in your browser using DataLab