Hi everyone,
I have a little problem, i need to do somithings like this:
B=c()
A=c(1:10)
A and B will be used in a "for cycle", in this cycle B will contain some index refered to a value of A
i need to remove the future value of B from A
A=A[-B]
obviously in the first loop i need B empty, cuz i'll take the value inside the cycle.
But if i use A=A[-B], with empty B the system tell me that the elemente is an invalid operator.
How can i subtract empty element for the first time?
example:
i need to see if the product of all the element of two vector is inside a range.
range=c(30,70)
A=c(1:1000)
K=sample(seq(0,1,0.001))
B=c()
for(i in K){
A=A[-B]
for(j in A){
if (i*j>min(range) & i*j<max(range)) {
B=c(B,which(A==j))
}}}
Error in -B : argomento non valido per l'operatore (invalid argument for the operator)
thank you!