Machine Learning for Factor Investing: R Version