Description Usage Arguments Details Value Author(s) See Also Examples
Adds phenotypic variables to phdata
part of an
gwaa.data-class
object
1 | add.phdata(data, newphdata, name)
|
data |
an object of |
newphdata |
data frame or a vector with new phenotypic data |
name |
if 'newphdata' is a vector, the name of new variable should be specified in 'name' |
If "newphdata" is a data frame, it is simply merged to
the phdata
part of the "data", and is sorted
according to the right order. In this case, The
"newphdata" frame should contain single variable named
"id", preferably of "character" class. It may contain
"sex" variable, but that will be re-named to avoid
duplication with the default sex variable presented in
phdata
.
If 'newphdata' is a vector, it should be of the same length as the number of people in the 'data' and is assumed to have the same order. In this case, you also need to supply the name of the new phenotype via the 'name' argument
An (updated) object of gwaa.data-class
Yurii Aulchenko
merge.gwaa.data
merge.snp.data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.