Add simple implementation in R