Suppose I have a list:
alist<- list(4,6,8,9)
I want test if each list element is greater than 7 and return a list of 1 if its true and 0 if
Another two:
lapply(alist > 7, as.integer)
or
lapply(alist > 7, ifelse, 1, 0)