search for: indexofcurrentelementof_v

Displaying 1 result from an estimated 1 matches for "indexofcurrentelementof_v".

2012 Jun 04
2
get index of current element in vector
(Just learning R) I have this vector: v <- c(1:10) Now, I want to multiply each element of that vector with a scalar value multiplied with its index: vm <- v * scalar * indexOfCurrentElementOf_v Is that possible without using a loop? In a loop I would do this: for (i in 1:length(a)) a[i] <- scalar * a[i] [[alternative HTML version deleted]]