R functions for data manipulation and strategy development