Home / R
Tuesday, July 5, 2022
I just read a great post by Jessica Duarte on teaching beginners to code. It is all so true. Especially #5, making mistakes: You [the instructor] have to ride out the mistakes. Make them often. Let the class fix them. It’s essential for students to see and experience the process of working through mistakes. Right... More
I just reviewed my first manuscript where the authors provided a reproducible analysis (i.e., they shared their data and analysis script with the reviewers). This is something my coauthors and I have tried to provide with our recent studies, but it was my first time experiencing it as a referee. I think it really... More
This is from a session I did with the UBC R Study Group. Loops can be convenient for applying the same steps to big/distributed datasets, running simulations, and writing your own resampling/bootstrapping analyses. Here are some ways to make them faster. 1. Don’t grow things in your loops. 2. Vectorize where possible. i.e. pull... More
Frame-blending is a great way to illustrate animal behaviour and other things that change over time. This got me thinking about ways to animate time series data. In R, the animation package has lots of options, but you can also build your own just by plotting over the same device window. If you save each iteration in... More
My learning curve with the statistical software R has been a long one, but one of the steepest and most exciting times was learning how to write functions and loops. Suddenly I could do all kinds of things that used to seem impossible. Since then, I’ve learned to avoid for loops whenever possible. Why?... More
Search