There are 9 methods defined for computing quantiles, see the help page for `quantile` in R for the details. You can choose between them using the `type` argument, the default is 7.
Your method corresponds to type 6 (and is that used by Minitab and SPSS):
x <- c(5, 8, 12, 42, 43)
sapply(1:9, function(y) quantile(x,type=y))["25%",,drop=FALSE]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
25% 8 8 5 5.75 7.25 6.5 8 7 7.0625
Each method uses a different weighted average of consecutive order statistics. The methods are defined in Hyndman, R. J. and Fan, Y. (1996) Sample quantiles in statistical packages, _American Statistician_ , **50** , 361–365.