auxiliary function to get movers origin and destination state in a data.table (AT THE BEGINNING OF CURRENT PERIOD, SAY)

get.istate(states, imove)

Examples

ttab = data.table(pid = rep(c(1,2),each=5),state=c(3,3,4,4,4,6,7,7,8,9),istate=c(FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE))
#> Error in data.table(pid = rep(c(1, 2), each = 5), state = c(3, 3, 4, 4, 4, 6, 7, 7, 8, 9), istate = c(FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE)): could not find function "data.table"
ttab[,c("from","to") := get.istate(states=state,imove=istate),with=FALSE]
#> Error in eval(expr, envir, enclos): object 'ttab' not found