From: Robin Hankin <[EMAIL PROTECTED]>
>
> I have a little function that takes a vector v and an integer i. I
> want to manipulate
> v[-i] (to give v.new, say) and
> then put (unmanipulated) v[i] back into the appropriate place. For
> example,
>
>
> f <- function(v,i){
> v.new <- v[-i]+10
> return(c(v.new[1:(i-1)],v[i],v.new[i:length(v.new)]))
> }
>
f <- function(v, i) replace(v+10, i, v[i])
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html