https://devhubby.com/thread/how-can-i-use-lapply-to-find-specific-indices-in-a