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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -