R GUI is puzzling me
date = final[final[i,2],1]
On 2/7/07, d. sarthi maheshwari <samay.sar at gmail.com> wrote:
Dear Sir/Madam,
I have a data.frame which consist of two columns and several rows. The
values of 2nd column can be either TRUE or FALSE.
I want to save all the value of first column in another variable whose
corresponding row in second column have value TRUE.
Please consider the following example:
#currently i am doing this.
date <- 0
j <- 1
for (i in 1:nrow(final))
{
if(final[i,2] == TRUE)
{
date[j] <- final[i,1]
j <- j+1
}
}
Is there any efficient method (single line code) to do the same?
--
Thanks & Regards
Sarthi M.
[[alternative HTML version deleted]]
_______________________________________________ R-sig-DB mailing list -- R Special Interest Group R-sig-DB at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-db
Byron Ellis (byron.ellis at gmail.com) "Oook" -- The Librarian