Blog Archives

Using Dates and Times in R

February 10, 2014
By
Using Dates and Times in R

Today at the Davis R Users’ Group, Bonnie Dixon gave a tutorial on the various ways to handle dates and times in R. Bonnie provided this great script which walks through essential classes, functions, and packages. Here it is piped through knitr::spin. The original R script can be found as a gist here. Date/time classes Three...

Read more »

Ryan Peek on Creating Shiny Apps

January 28, 2014
By

Yesterday at the Davis R User’s Group1, Ryan Peek gave a talk about using the shiny package to create interactive web apps with R. Here are his slides. Ryan includes a bunch of links to examples and tutorials, as well as his own thermohydrographs app:Thanks to Revolution Analytics for another year of...

Read more »

How to format plots for publication using ggplot2 (with some help from Inkscape)

November 20, 2013
By
How to format plots for publication using ggplot2 (with some help from Inkscape)

The following is the code from a presentation made by Rosemary Hartman to the Davis R Users’ Group. I’ve run the code through the spin function in knitr to produce this post. Download the script to walk through here. First, make your plot. I am going to use the data already in R about sleep habits...

Read more »

Printing R help files in the console or in knitr documents

June 18, 2013
By

Yesterday, I was creating a knitr document based on a script, and was looking for a way to include content from an R help file. The script, which was a teaching document, had a help() command for when the author wanted to refer readers to R documentation. I wanted that text in my final document, though. There’s no...

Read more »

Dave Harris on Maximum Likelihood Estimation

June 17, 2013
By
Dave Harris on Maximum Likelihood Estimation

At our last Davis R Users’ Group meeting of the quarter, Dave Harris gave a talk on how to use the bbmle package to fit mechanistic models to ecological data. Here’s his script, which I ran throgh the spin function in knitr: # Load data library(emdbook) ## Loading required package: MASS Loading required package: lattice library(bbmle) ## Loading required package:...

Read more »

The null model for age effects with overdispersed infection

June 12, 2013
By
The null model for age effects with overdispersed infection

How does overdispersion of infections affect the behavior of the multiple-infection model? I redefine the model to account for overdispersion, assuming the same overdispersion occurs in both age classes. The parameter varies inversely with the degree of overdispersion. Again, the classes are demographically identical, and infection affects mortality but not growth: \[\begin{aligned} \frac{dJ}{dt}...

Read more »

A Null Model for Age Effects in Disease with Multiple Infections

June 11, 2013
By
A Null Model for Age Effects in Disease with Multiple Infections

Here’s a little thought exercise I did that has caused me to go back and restart my Sudden Oak Death modeling in a new framework. Feedback welcome. I’m especially interested in relevant literature – I haven’t found many good examples of macroparasite/multiple infection models with age structure. Introduction Cobb et al. (2012) develop two models of forest stand demography...

Read more »

Robert Hijmans on Spatial Data Analysis

May 23, 2013
By

Last week at the Davis R Users’ Group Robert Hijmans gave a talk about spatial data analysis in R. Robert is a professor of biogeography at UC Davis and the author of the raster (analysis of gridded data), dismo (species distribution modeling), and geosphere (spherical trigonometry), packages. Robert’s presentation spanned topics including basic...

Read more »

Improved R Profiling Summaries

May 2, 2013
By

In my last post I mentioned that I had improved on R’s summaryRprof() function with a custom function called proftable(). I’ve updated proftable() to take advantage of R 3.0.0’s ability to record line numbers while profiling. I’ve put it on github – you can get it there or below. proftable reads in a file generated by...

Read more »

FasteR! HigheR! StrongeR! – A Guide to Speeding Up R Code for Busy People

April 25, 2013
By
FasteR! HigheR! StrongeR! – A Guide to Speeding Up R Code for Busy People

This is an overview of tools for speeding up your R code that I wrote for the Davis R Users’ Group. First, Ask “Why?” It’s customary to quote Donald Knuth at this point, but instead I’ll quote my twitter buddy Ted Hart to illustrate a point:I’m just going to say it.I like for loops in #Rstats,...

Read more »