Added R scripts for sd filtering