I think this may help. my_assign <- function(operand, value) { assignment <- paste(operand, value, sep = "<-") e <- parse(text = assignment) eval.parent(e) } a <- rep(0,5)> a[1] 0 0 0 0 0 my_assign("a[2]", 7)> a[1] 0 7 0 0 0 my_assign("a[4]", 12)> a[1] 0 7 0 12 0 -- GG [[alternative HTML version deleted]]