adapted John BM's constant column method using sapply