This past week saw two interesting decisions from the Baillieu Government. On Tuesday the Secretary to the Department of Sustainability and the Environment sought judicial review in the Federal Court of the Federal Environment Minister Tony Burke’s decision to deny, under the EPBC Act, cattle grazing in the Alpine National Park. Then on Thursday, The Age revealed that a letter had been sent to 229 graziers earlier in the week that revealed that the government had put on hold plans to gazette stretches of the Murray River and reversed a decision to revoke grazing licenses in the same areas by September next year.

It seems that the Victorian Government is really keen to have as many cattle on public land as they can legally get. Unfortunately biodiversity may be the unwitting victim if the state government’s infatuation is allowed to blossom.

Much scientific evidence points towards a negative relationship between cattle grazing and the welfare of the alpine environment. Indeed, part of the submission by the Victorian Government relies on the Federal Government’s reference to published scientific work outlining many of these undesirable impacts. The Secretary to the DSE argues that Tony Burke should not have considered this work, as it did not form part of the original referral, and that doing so without giving Victoria a chance to respond denied it natural justice. Much of the legal argument in the Federal Court over the next few months may revolve around whether the Environment Minister should have provided an opportunity to respond to the science around alpine cattle grazing or whether, as they were published scientific works, they could be considered common public knowledge and be legally relied upon to make decisions under the EPBC Act. By all accounts the Federal Court Judge hearing the application, at least in its early stages, Justice Susan Kenny, is well equipped to handle the scientific aspects of the case. It’ll certainly be interesting to see the what the outcome of this case is and if it has implications for future referrals under the EPBC.

Like cattle grazing in the alps much evidence has already been documented in the scientific literature that points towards a negative effect on biodiversity when cattle are allowed to graze in riparian zones (see for example their impacts on native birds). Further, removal of grazing adjacent to watercourses can have measurable beneficial effects for biodiversity within ten years. Despite this, the State Government now has no timeline to remove grazing from stretches of the Murray that had formerly been proposed as a new and much needed park to protect our states biodiversity.

This is a neat little example demonstrating the power of control flow (type ?Control in R to find out more). But perhaps a not-so obvious way of using it. So what does this snippet of code do? It simply makes three Bernoulli samples with p=.5 (or three fair coin flips if you like). But it will only return sets that aren’t all zeros. There are probably lots of other ways to do this and it’s a fairly trivial example. But the concept is useful and has wider application.

So what exactly is going on. The point of while is to keep evaluating the expression in the set of curly brackets as long as the result of the logical statement enclosed in the first set of brackets is TRUE. In this example the expression in the curly brackets is absent, so all while does is keep checking the result of the first expression. This is where it gets interesting. Because of R’s object orientation we can assign some value to x and interrogate the properties of x at the same time. In this case I’ve asked, “are there any 1’s?”, and if so while will stop evaluating. Which is exactly what we wanted. This technique could be useful for quite a few things. In my case I have been using it to sub-sample some large datasets but making sure the sub-samples meet certain conditions. Another use might be to evaluate some external process or the properties of a local file or website. As Brian Butterfield would say, “it’s up to you”.

Today ‘rjags’ was annoying me. The function ‘update.jags’ was (without asking me) disabling the progress bar when I was running R non-interactively. It was annoying, as I was sending R output to a log file in my dropbox, and having model progress written to a remotely accessible file would have == cool! A quick look at the source code showed it was just a tiny change required to get the progress bar back on. Unfortunately ‘update.jags’ is a relatively low level function attached to the ‘rjags’ namespace and not exported. So simply redefining it wasn’t an option. But changing the source and reinstalling ‘rjags’ seemed like overkill and I’d have to do that every time ‘rjags’ was updated. Wouldn’t it be cool if you could just reassign an object inside a namespace? Well you can!

Use ‘gsub’ to remove the offending bit of R code, ' interactive() &&', and a combo of ‘:::’, ‘deparse’, ‘parse’ and ‘eval’ to get the original function and feed it back to the namespace in an altered form. Pretty cool.