Publications by Gregor Gorjanc
Converting strsplit() output to a data.frame
R has a nice set of utilities to work with strings. Function paste is surely one among these. It can be used to “glue” several strings with optional separator. The following example shows how paste can be used to create a new variable in a dataset:dat <- data.frame(x=1:5, y=letters[1:5]) (dat$z <- with(dat, paste(x, y, sep="-")))Today I was ...
1439 sym R (327 sym/4 pcs)
Nice simple notes on running R in parallel by Geyer
Here, by Charles J. Geyer. Related To leave a comment for the author, please follow the link and comment on their blog: Gregor Gorjanc (gg). R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job. Want to share your con...
430 sym
gRain: genetics example
gRain is an R package for “probability propagation in graphical independence networks, also known as probabilistic expert systems (which includes Bayesian networks as a special case)”. This package caught my attention because some genetic models can be seen as graphical models, which is a broader class of models encompassing Bayesian network...
4143 sym R (2295 sym/5 pcs) 2 img
Setup up the inverse of additive relationship matrix in R
Additive genetic covariance between individuals is one of the key concepts in (quantitative) genetics. When doing the prediction of additive genetic values for pedigree members, we need the inverse of the so called numerator relationship matrix (NRM) or simply A. Matrix A has off-diagonal entries equal to numerator of Wright‘s relationship c...
5353 sym R (5172 sym/6 pcs) 4 img
Polyploidy in sugarcane
While reading UseR conference abstracts I came across this sentence: “Sugarcane is polypoid, i.e., has 8 to 14 copies of every chromosome, with individual alleles in varying numbers.” Vau! This generates really complex genotype system. Say we have biallelic gene with alleles being A and B. In diploids the possible genotypes are AA, AB, and BB...
1103 sym R (1788 sym/1 pcs)
GBLUP example in R
Shirin Amiri was asking about GBLUP (genomic BLUP) and based on her example I set up the following R script to show how GBLUP works. Note that this is the so called marker model, where we estimate allele substitution effects of the markers and not individual based model, where genomic breeding values are inferred directly. The code:library(pack...
755 sym R (3936 sym/2 pcs)
Regression – covariate adjustment
Linear regression is one of the key concepts in statistics [wikipedia1, wikipedia2]. However, people are often confuse the meaning of parameters of linear regression – the intercept tells us the average value of y at x=0, while the slope tells us how much change of y can we expect on average when we change x for one unit – exactly the same as...
1233 sym R (1996 sym/1 pcs)
Small pedigree based mixed model example
Pedigree based mixed models (often called animal models, due to modelling animal performance) are the cornerstone of animal breeding and quantitative genetics. There are many programs that can be used for analyzing your data with these models, e.g., ASREML, BLUPf90, MATVEC, MiXBLUP & MiX99, SurvivalKit, PEST/VCE, WOMBAT, …). There are also ...
1335 sym R (9545 sym/2 pcs)
2 min HOWTO in R
Lots of short videos on how to do several things in R. Related To leave a comment for the author, please follow the link and comment on their blog: Gregor Gorjanc (gg). R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/da...
470 sym
Parse arguments of an R script
R can be used also as a scripting tool. We just need to add shebang in the first line of a file (script):#!/usr/bin/Rscriptand then the R code should follow.Often we want to pass arguments to such a script, which can be collected in the script by the commandArgs() function. Then we need to parse the arguments and conditional on them d...
1032 sym R (969 sym/1 pcs)