# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())
PCARV <- snpgdsPCA(genofile, eigen.cnt=8)
SnpLoad <- snpgdsPCASNPLoading(PCARV, genofile)
names(SnpLoad)
# [1] "sample.id" "snp.id" "eigenval" "snploading" "TraceXTX"
# [6] "Bayesian" "avefreq" "scale"
dim(SnpLoad$snploading)
# [1] 8 8722
plot(SnpLoad$snploading[1,], type="h", ylab="PC 1")
# close the genotype file
snpgdsClose(genofile)
Run the code above in your browser using DataLab