Got the R script to work. It now outputs the correct CSV of helices and sheets.