Hello,
I have a data.frame (below) containing the two fields of "Value" and "Signal" 
and I would need to create the third field of "To_Be_Produced". The condition 
for producing the third field is to carry the 1 in the "Signal" field down 
until "Value" is below 40.
Do I have to create a for-loop to do this or will I be able to do anything else 
more efficient?


df <- data.frame( Value=c(0,0,100,85,39,1,30,40,20,20,0,0),
                  Signal=c(0,1,0,0,0,0,0,0,0,1,0,0),
                  To_Be_Produced= c(0,1,1,1,0,0,0,0,0,1,0,0)
                )

Thank you,
Pooya.




***
We are pleased to announce that, as of October 20th, 2014, we've moved to
our new office at:
Platinum Partners
250 West 55th Street, 14th Floor, New York, NY 10019
T: 212.582.2222 | F: 212.582.2424
***
THIS E-MAIL IS FOR THE SOLE USE OF THE INTENDED RECIPIENT(S) AND MAY CONTAIN
CONFIDENTIAL AND PRIVILEGED INFORMATION.ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE
OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE
CONTACT THE SENDER BY REPLY E-MAIL AND DESTROY ALL COPIES OF THE ORIGINAL 
E-MAIL.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to