Hello everyone, I need to create a vector based on some conditions I have on other variables. Basically, I have 672 entries (hour 1,2,3…) for q ,q1 and q2. q1 is priced at p1 and q2 is priced at p2. I basically want to write a new "column" or vector with the results from the loop: if less than q1, price is p1, if not, if up to q1+q2, the price is p2. However, I am not able to save this results for each one of the 672 hours. How could I do that?
if q=q1 p=p1else if q=q2+q1 p=p2else p=p3endend
Thank you!
Best Answer