Today is Day 2 of my teaching R in my grad level remote sensing class (for background info you might want to read the Day 1 blog post here). The goals for today were to (1) write a for-loop to read in the worldclim data; (2) make a plot; (3) write ANOTHER for-loop to stack the worldclim data for global analyses; and (4) write a function to apply using raster::calc across the globe. However, per-usual I was overly ambitious in my expectations for what we could accomplish (we also spent ~20 min reviewing exams that were handed back, which slowed us down). As a result, we made it through most of 1 and 2 (which were originally part of my plan for Day 1...), and I left the last bit of plotting to the students. For the most part the for-looping went just fine, but some students got caught up getting the file names correctly written out.
We'll pick up here in the next class meeting and talk about my favorite function in R: raster::calc.
One thought - the code I've been running through is 'complete' meaning you could run the whole thing and get a nice looking plot. For stuff like plotting, though, it probably would have been better/more satisfying for students to start with a simple plot (a line or barplot) then add to it to make it more complex. It was probably hard for students to follow how and why I set up the plots the way I did (with some "n" parts). A good thought for next time!
ERSAM Lab Thoughts
This is where we occasionally post things that are not research, but more than 280 characters. If you want to know what we're working on now, this would be a good place to look. Code will be linked to here and posted on github.