Category: Programming tips

Interactive visualization of survival curves with Shiny

We have a growing interest in using our favorite tools (R and Mathematica) to build web interfaces to interactively explore and visualize data. Our last 5 posts have involved interactive tools, namely Mathematica’s computable document format and R’s new Shiny package.

Macklemore and Fourier

The Heist by Macklemore and Ryan Lewis is a masterpiece. It is clearly the best album of 2012, and I suspect it will go down alongside classics like Illmatic, The Chronic, The Marshall Mathers LP, and The College Dropout.

Shiny = Happy People

The people behind the wonderful RStudio, which I gushed about in a previous post, have developed a new package, Shiny, that makes it easy to develop interactive web applications with R.

Comparing stolen paintings: Picasso and Matisse

Art Heist Last week, burglars stole seven paintings from the Kunsthal museum in Rotterdam. The paintings included works by Picasso, Monet, Gauguin, and Matisse. The loot is likely worth hundreds of millions of dollars, but the loss of these great pieces surpasses anything that can be calculated as a monetary figure.

Good programming practices in R

I write sloppy R scripts. It is a byproduct of working with a high-level language that allows you to quickly write code on the fly (see this post for a nice description of the problem in Python code) and the result of my limited formal training in computer programming.

Zing! Mathematica one-liners

I love the elegant simplicity of programming in Mathematica. There is something undeniably beautiful about accomplishing something complex in a concise chunk of code. A famous Mathematica mantra is, “if you are using a For loop, you are probably doing it wrong.

NetLogo: a powerful platform for agent-based models

A quick break from my usual R-centric posts to toot the horn of one of my other favorite pieces of freeware, NetLogo, which “is a multi-agent programmable modeling environment.” If you are interested in modeling complex systems and spatially-explicit behavior or processes, you should definitely take the time to (at least) download NetLogo and browse a few of the many example models.

RStudio is RStupendous

I am a sucker for beautiful applications. The latest R-related application to catch my eye is RStudio. RStudio™ is a free and open source integrated development environment (IDE) for R.

On Labor Day, make your computer's job easier with Milstein's method

In today’s post, we will explore numerical schemes for integrating stochastic differential equations in Mathematica. We will take an informal approach; for an in-depth treatment of stochastic differential equations, I recommend that you look at Stochastic Processes for Physicists by Kurt Jacobs and Modeling with Ito Stochastic Differential Equations by Edward Allen.

Using paste to read and write multiple files in R

This post is a quick tip on how to use the paste1 function to read and write multiple files. First, let’s create some data. dataset = data.frame(expand.grid(Trt=c(rep("Low",10),rep("High",10)), Sex=c(rep("Male",10),rep("Female",10))), Response=rnorm(400)) The next step is not necessary, but makes the subsequent code more readable.

Transformation of axes in R

As a general rule, you should not transform your data to try to fit a linear model. But proportions can be tricky. If the proportion data do not arise from a binomial process (e.

Spacing of multi-panel figures in R

In a previous post, I showed how to keep text and symbols at the same size across figures that have different numbers of panels. The figures in that post were ugly because they used the default panel spacing associated with the mfrow argument of the par function.

Voronoi Diagrams in Mathematica

Ecological models sometimes find very unexpected applications. Work on wolf territory modeling by Mark Lewis’s research group at the University of Alberta has been employed by researchers studying gang territories in Los Angeles.