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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -