Blog Archives

Working with NIfTI images in R

October 1, 2014
By
Working with NIfTI images in R

The oro.nifti package is awesome for NeuRoimaging (couldn't help myself). It has functions to read/write images, introduces the S4 nifti class, and has useful plotting functions. There are some limitations and some gotchas that are important to discuss if you are working with these objects in R. Dataset Creation We'll read in some data (a

Read more »

Sorted HTML Tables and Javascript Libraries

August 4, 2014
By
Sorted HTML Tables and Javascript Libraries

A few days ago StatsInTheWild asked the following question In the R function “sortable.html.table”, it's sorting 9.2 higher than 30.5 because of the leading digit. How do I fix this? — SITW (@StatsInTheWild) July 23, 2014 So we had a few exchanges where I thought you could use sprintf and be done but it didn't

Read more »

Sometimes Table is not the Answer – a Faster 2×2 Table

July 7, 2014
By
Sometimes Table is not the Answer – a Faster 2×2 Table

The table command is great in its simplicity for cross tabulations. I have run into some settings where it is slow and I wanted to demonstrate one simple example here of why you may want to use other functions or write your own tabler. This example is a specific case where, for some examples and

Read more »

R is a Language: Treat it Like One

June 30, 2014
By
R is a Language: Treat it Like One

I'm helping out with teaching a class on an introduction to R for students this week. I figured it'd be a good time to discuss my thoughts on programming in R and how a newcomer should feel about learning the language. Those Who Teach R, Should Use R Many of the students in the class

Read more »

Be Careful with Using Model Design in R

June 25, 2014
By
Be Careful with Using Model Design in R

In R, useful functions for making design matrices are model.frame and model.matrix. I will to discuss some of the differences of behavior across and within the two functions. I also have an example where I have run into this problme and it caused me to lose time. Using model.frame for a design matrix Whenever I

Read more »

fslr: An R Package Interfacing with FSL for Neuroimaging Analysis

June 16, 2014
By
fslr: An R Package Interfacing with FSL for Neuroimaging Analysis

I use a set of neuroimaging tools, but my language of choice is R. FSL, which is from the University of Oxford's Functional MRI of the Brain (FMRIB), and stands for FMRIB Software Library, is one tool I commonly use. I wrote some wrapper functions into an R package called fslr and wanted to discuss

Read more »

Making Back-to-Back Histograms

June 10, 2014
By
Making Back-to-Back Histograms

A colleage of mine asked me how to do back to back histograms (instead of on top of each other). I feel as though there should be a function like voilin plot from the vioplot package. Voilin plots are good for displaying data, but the violin must have the left and right (or top and

Read more »

SMART Hackathon: Day 2: Writing Packages in RStudio

May 6, 2014
By
SMART Hackathon: Day 2: Writing Packages in RStudio

So day 2 of the #JHUSMARTHack was last week, but I figured this would be a good time to discuss what was accomplished. I created some packages that are somewhat specialized and aren't fully finished yet, so I'll hold off. What I really want to discuss though is why I like using RStudio for making

Read more »

SMART Hackathon: Day 1

May 1, 2014
By
SMART Hackathon: Day 1

So day 1 of the #JHUSMARTHack 2014 is over and day 2 is underway. It's been awesome. One student estimated he did “one week's worth of work”. Some interesting (I think) things I thought about: Flooding rain is good weather for coding. (As long as no sinkholes arise) The Admiral Fell Inn is a pretty

Read more »

SMART Hackathon 2014

April 30, 2014
By
SMART Hackathon 2014

Today is our SMART group's 2014 Hackathon! We will be at an undisclosed location, just plugging away at code/packages/apps. The mission statement: There's no structure except that you have to work on a software project and you have to present what you accomplished or didn't at a subsequent SMART meeting. We will be tweeting at

Read more »