Lambda expression in R