# to write existing data `kinship`, `M`, and `fam` into files "data.grm.bin" etc, run like this:
# write_grm("data", kinship, M = M, fam = fam )
# The following example is more detailed but also more awkward
# because (only for these examples) the package must create the file in a *temporary* location
# create dummy data to write
# kinship for 3 individuals
kinship <- matrix(
c(
0.6, 0.2, 0.0,
0.2, 0.5, 0.1,
0.0, 0.1, 0.5
),
nrow = 3
)
# pair sample sizes matrix
M <- matrix(
c(
10, 9, 8,
9, 9, 7,
8, 7, 8
),
nrow = 3
)
# individual annotations table
library(tibble)
fam <- tibble(
fam = 1:3,
id = 1:3
)
# dummy files to write and delete
name <- tempfile('delete-me-example') # no extension
# write the data now!
write_grm( name, kinship, M = M, fam = fam )
# delete outputs when done
delete_files_grm( name )
Run the code above in your browser using DataLab