vector operations in R