Monthly Archives: April 2015


In order to make the process more inclusive, the entire roboKelp project has been moved to a Dropbox folder. The relevant parties have access to it and can add/ change things as they see fit. This is nice but the lack of version control on Dropbox (as opposed to GitHub) means that if someone accidentally changes/ deletes something it is toast unless backed up elsewhere. Anyway, I’ve updated the main load script, which also makes some preliminary graphs, so that it can run directly from this Dropbox folder. This is where new data will be added in the future as well. Unfortunately I spent hours wrangling with a POSIXct parsing issue that now appears to be an artifact of either Ubuntu itself, or the way my computer is running. Way deep down in the R repository or lower. I was able to finish the script on my old Sony running Windows 7.

While it is good that I have sorted this and it is ready for statistical analyses etc., I need to get back to my work. Tomorrow I have a morning engagement and then I need to prep the tut for the R class I am teaching on Thursday. Hopefully we are going diving on Friday. Angé is busy over the weekend so I will probably be able to put in some quality time on my work then… Life moves at a quick pace!

Tut 2

The second Tut for the R course I am teaching is finished and shipped off to the honours students.  I’ve attached it here for good measure. I’m going with the philosophy of show rather than explain. It worked moderately well last week and we’ll see how they do on Friday. The diving has been cancelled so it is time for R instead. I am going to give them hands on experience managing raw data and loading it into R. Then I have written a script for them that will prep the data once in R using melt() as well as combining and sorting things. Then they’ll see how to quickly plot the data to see what it is doing before they run a t.test() and aov(), which is like ANOVA. Finishing up with a biplot of stipe and frond length for the different species that they will be learning how to amend next week.


After finishing that I jumped on the presentation I’m to give for “Wise Weeds” on Thursday. This is the phycology departments journal club. I picked a short 6 page article on climate change and whipped up a powerpoint in which to put down some key points and copy in some of the figures from the pdf. Unfortunately there isn’t a great way to do this without either loosing a lot of resolution or killing the RAM in my laptop somehow. After getting 3 of 6 figures into powerpoint the pdf reading program hangs so bad it no longer functions *sigh*. So I’ve tabled that bit for tomorrow as I believe I will have to restart my laptop at least once more to clear the RAM and let the program function. The rest of the presentation is finished at least.

Back in Cape Town

The trip to De Hoop was fantastic. The most amazing thing for me was just how many zebra, eiland and bontebuck were walking around in the camp sites. Unfortunately none of our permits cleared in time for us to sample kelp or deploy the UTR, so it was just an R&R weekend. We will however be getting permission to deploy the UTR soon and so when the seaweed unit goes back to De Hoop in a couple of weeks I will likely be going with them.

Today I sorted out the diving admin from having borrowed gear over the weekend and got everything back to neutral status. Then I tackled some more office admin before getting started on the R tut that I may be teaching on Friday. This time I am teaching the honours students how to do t.tests and ANOVAs and then plot some results. But this means I need to fully understand these functions so I have been brushing up on these statistics again. I want the finished product to look better than the first one so I have been doing some more tufte handout tutorials as well. I should have this wrapped up by tomorrow afternoon. Then I need to sort out my presentation for wise weeds on Thursday. Potentially we are going diving on Friday where we will make the first run on “Operation: Cyborg Kelp”. So I plan on revisiting the draft code I have written for managing that.

acast() you beauty

Today I learned that creating arrays of data (useful for storing information in 3D) is incredibly easy. I was prepared to spend an entire day devising cunning logic loops to morph the new cyborg kelp data set into 3D data when I discovered that the function dcast(), which one uses to make “wide” data frames from “long” data frames has a sister function, acast(). The only difference is that with acast() one may also specify the third dimension by which to subset the data. So instead of a ten line logic loop, I was able to do each type of data in only one compact line. Beautiful.

Now I’m off to Angé’s end of term wild west themed party before heading out for De Hoop early tomorrow morning. All of the diving kit , cylinders and camping gear are packed and ready to go!

Writing code

All I did today was write code 🙂 Awesome. Plus a bit of admin, but that’s life. I went through the second chapter of the “Advanced R” book and converted all of the code into a .R file that the honours students, or anyone, can peruse to learn more about the basics. This file is in the “Adv R” folder. It’s in a nice step by step format.

After that I made a rough draft of the load/ prep script for the cyborg data. The idea is to have a complete: load -> prep -> proc-> graph workflow already coded before we get our first batch of data. This could potentially be as early as next week, but the weather isn’t cooperating… So we shall see. Anyway, it’s great fun to be able to apply my R expertise to a new project and watch it build from the holdfast up. I got some dummy files that were generated by the same instruments we will be using and the mock up is coming along nicely. But this will require the data to be in an array rather than only a data.frame as the 3D is unavoidable.

And now I’m off to meet up with Team Kelp and Co. at the Tokai market for dinner and drinks. Life is good.

Teaching and learning

Today was an all-around exciting day.

Started off going over an older classification script, and with my newly developed ordination/ classification knowledge I was much more confident in my understanding of what and why things were happening.

I then went to UWC where I taught the first class of my R course for the honours students and anyone else that wanted to attend. Had a few extras too, which was great. The class went well and I got a lot out of it. Definitely learned a few things to avoid/ be ready for the next time I am teaching that tut. And at the end one of the MSc students sitting in asked if I knew a way to do PCA (principal component analysis) in R. Which is literally what I spent all of yesterday learning how to do. What are the chances! So I wrote up a quick draft of a tut for her (I needed to write this tut eventually anyway) and sent that off. Hopefully it will help her out.

Before the R course I had a meeting with AJ (my supervisor), Thomas (AJ’s Australian counterpart and partner in crime) and Sam (MSc student and diver) and they outlined an idea for Sam’s masters thesis which has tentatively been classified as “Operation: Cyborg Kelp”, and AJ wants me to be a co-supervisor 🙂 It may mean lot’s more work but what a great opportunity! The details of the project are very exciting and will likely involve a presently unheard of and unattempted level of shenanigans in order to pull everything of. But Team Kelp is not known to shy away from a challenge!

Also, AJ has entrusted a new R book to me for a short while. Advanced R by Hadley Wickham. I intend to go through a chapter per evening, time and social life allowing. And will be posting the R code that I create going through the exercises in the book here. This will be a solid step towards making this blog more interesting to R bloggers and eventually to perhaps start getting my entries put up on the R-bloggers website.

The great ordination tutorial

It’s been non-stop go since my last blog entry.

Diving on Friday went very well. The conditions were about as perfect as they can get so we were able to go to some cool sites. Specifically Romans Rock and Batsata Rock (we also went to the back side of A-frame, beyond where sport divers go). Because Romans Rock (the lighthouse out in False Bay) is away from the coast the bottom topography is much different to anything  I’ve seen before in SA. We collected kelp and deployed a UTR on a rock pinnacle that sloped down sharply on all sides. Definitely not the typical granite boulder or sandstone slab reefs you see along the coastline. Batsata rock was gorgeous as well. With a sparsely populated understory a the six metres depth we were sampling, the “Kelp Forest” visual was particularly stunning. This is also one of the most diverse locations I’ve seen with all sorts of biodiversity. Urchins, anemones, crabs, fish, sharks and seals! Not bad.

Saturday I attended to some De Hoop and diving admin. I also updated the descriptive and metadata documents for our diving operations, which may be seen here:

Sunday I wrote the first tut for the R course I will begin teaching tomorrow at UWC. Exciting times!Tut_1 I used R markdown to create it with a new (to me) format called tufte_handout. It is designed to place more things in the margin. Still getting the hang of it and one can see some spacing issues at just a cursory glance, but once I sort that out and start teaching them how to create figures etc. it is really going to start looking great!

Ross and a couple of other divers went out to Betty’s Bay today to finish off the first phase of his project. I didn’t go with this time so that I could focus on getting some more computer time in. And I finally worked through the 43 page “vegan” R package tutorial. I’m not sure if I am now more or less confused… But at least I have created a 200+ line script that shows what all of the different bits in the package do. So that is good?

Tomorrow morning I will start getting it into the script I am using for my Chapter 2 analyses before going to UWC to teach this course. I am very excited about that. The wind is really picking up this week, making diving look rather unlikely. Meaning that I will be able to get some serious work done on my analyses and make a big step towards finishing up the first draft of Chapter 2. Big party with Angé’s MBA class (end of term wild west themed party) on Thursday night and then we are heading to De Hoop Friday morning for an exciting weekend! Quite the week forming up.

Bonus Diving

So we decided to squeeze in an extra day of diving tomorrow, which is great as we will get to see how effective our methodology is without a boat. I have high hopes.

The downside of this is that I spent the whole day on admin instead of doing the tut on ordination. And now I will be diving for the next two days so this week is pretty much through for any statistical learning… Still need to write up a tut for the R course which is now tentatively scheduled for Monday.

Ordination Basics

Had a long relaxing four day weekend and started off this week with some admin on the upcoming diving excursion I’m planning for Friday. Unfortunately this means the R course I was going to teach that day will have to be pushed back to next week. A bit of a sitcom moment happened today when I asked the honours student class rep if they would be available to go diving on Friday and they said no because they were going on a “field trip”. But it turns out that “field trip” was the diving excursion. *sigh*. At least we have enough staff for Friday now.

Besides admin I took a couple of steps back on where I was at with understanding ordination in order to learn the fundamentals. So I read the intro to the concept here as well as the glossary on the terms so I know what all of the acronyms mean. For tomorrow I already have a 43 page tut lined up to work through that is designed to teach the vegan package in R. This is exactly what I have been looking for.