On similar lines, how do I assign the position of the an occurence of a
value say 7 in a data vector to another data vector?

> nFields
 [1] 6 6 6 6 6 6 7 7 6 6 6 7 6 6 6 6
I need the output data vector showing occurence of 7 as:
[1] 7 8 12

I tried following but both has errors
xFields7 <- NULL
for (i in 1:length(nFields)) {
 c(xFields7,ifelse(nFields[i] == 7,i,NULL)) -> xFields7
}

xFields7 <- NULL
for (i in 1:length(nFields)) {
 if nFields[i] == 7 then c(xFields7,i) -> xFields7
}

	[[alternative HTML version deleted]]

