previous posts and r code copied over