r - if else statement in data.table package -


i have dataset of 6 column , 4.5 millions rows. write logical check if in fifth column there values zeroes, put 1 in sixth column. explain me how construct algorithm this? in fifth column found have cells 0 value. want perform if in fifth column have 0 values put 1 in sixth column , if not put 0? must use data.table package. try name of data[,6] = ifelse(name of data[,5] == 0, 1, name of data[,6]).

usingdata.table, can use :=, more efficient (example data @plafort's post)

library(data.table)#v1.9.4+ setdt(df)[x5==0, x6:=1]  

Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -