Hi,

I would like to process each row of data frame having 8 columns of which I am 
interested in 4 columns for my analysis.I tried using apply function but I get 
syntax error,although I checked for missing syntaxes ,couldn't figure out the 
mistake.Can you also suggest me more efficient way to perform same action.
# creating target column from result
kdata$target <- apply(kdata,1,ifelse((kdata$H1 & kdata$H2 & kdata$H3 &
                                                         kdata$H8) == 
1,"all-true",(ifelse(kdata$H1== 0 &
                                                                                
                            kdata$H2 == 0 &
                                                                                
                            kdata$H3 == 0 &
                                                                                
                            kdata$H8 == 0) ,
                                                                                
                   "all-false","other")))
Thanks.
Alily
This e-mail (including attachments) contains contents owned by Rolls-Royce plc 
and its subsidiaries, affiliated companies or customers and covered by the laws 
of England and Wales, Brazil, US, or Canada (federal, state or provincial). The 
information is intended to be confidential and may be legally privileged. If 
you are not the intended recipient, you are hereby notified that any retention, 
dissemination, distribution, interception or copying of this communication is 
strictly prohibited and may subject you to further legal action. Reply to the 
sender if you received this email by accident, and then delete the email and 
any attachments.

        [[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