For a given hour I want to be able to add a new column called flag. The flag column will flag the highest price in a given hour. Is there a way to do this without a loop?
matrix: Unit, Day, Hour, Price, Flag afd1 1/2/2003 1 1 N afd1 1/2/2003 1 2 N afd1 1/2/2003 1 3 N afd1 1/2/2003 1 4 Y dcf1 1/2/2003 2 2 N dcf1 1/2/2003 2 3 Y dcf1 1/2/2003 2 1 N dcf1 1/2/2003 2 2 N dcf1 1/2/2003 2 3 Y ghg2 1/2/2003 3 1 N afd1 1/2/2003 3 2 N ..... -- View this message in context: http://r.789695.n4.nabble.com/flagging-values-without-a-loop-tp4632689.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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.