Publications by strictlystat
matlabr: a Package to Calling MATLAB from R with system
In my research, I primarily use R, but I try to use existing code if available. In neuroimaging and other areas, that means calling MATLAB code. There are some existing solutions for the problem of R to MATLAB: namely the R.matlab package and the RMatlab package (which can call R from MATLAB as well). I do not use thse solutions usually though...
3634 sym R (764 sym/5 pcs) 4 img
A small neuroimage interactive plotter
Manipulate Package The manipulate from RStudio allows you to create simple Tcl/Tk operators for interactive visualization. I will use it for a simple slider to view different slices of an image. library(manipulate) fslr package I'm calling the fslr package because I know that if you have it installed, you will likely have FSL and have a 1mm T1 ...
2184 sym R (1017 sym/4 pcs) 8 img
Line plots of longitudinal summary data in R using ggplot2
I recently had an email for a colleague asking me to make a figure like this in ggplot2 or trellis in R: As I know more about how to do things in ggplot2, I chose to use that package (if it wasn't obvious from the plot or other posts). Starting Point Cookbook R/) has a great starting point for making this graph. The solution there is not suffic...
5914 sym R (4449 sym/16 pcs) 20 img
#rstats Make arrays into vectors before running table
Setup of Problem While working with nifti objects from the oro.nifti, I tried to table the values of the image. The table took a long time to compute. I thought this was due to the added information about a medical image, but I found that the same sluggishness happened when coercing the nifti object to an array as well. Quick, illustrative si...
2243 sym R (1110 sym/2 pcs) 4 img
Rendering LaTeX Math Equations in GitHub Markdown
The Problem: GitHub README.md won't render LaTeX I have many times wondered about getting LaTeX math to render in a README file on GitHub. Apparently, many others ( 1, 2, 3 ), have asked the same question. The common answers are: It cannot (and in some cases, shouldn't) be done. GitHub parsing is done by SunDown and is secure, therefore won't...
6089 sym R (545 sym/5 pcs) 4 img
A better interactive neuroimage plotter in R
In a previous post, I described how you can interactively explore a 3D nifti object in R. I used the manipulate package, but the overall results were sluggish and not really usable. I was introduced to a a good neuroimaging viewer called Mango, by a friend or two and use it somewhat inconsistently. One major advantage of this software is that ...
5115 sym R (502 sym/4 pcs) 12 img
Recommendations for First Year Graduate Students
This blog post is a little late; I wanted to get it out sooner. As new students have flooded the halls for the new terms at JHU Biostat, I figured I would give some recommendations to our new students, and biostatistics students in general. Some of these things may be specific to our department, but others are general, so the title should be fit...
11425 sym 4 img
Dealing with Imposter Syndrome in Graduate School
In my post of recommendations for first-year students, I discussed some tips and viewpoints to help the practical, pragmatic aspects about being a first year student. In this post, I'd like to discuss the common misconceptions/viewpoints that are destructive to new students. The Dunning-Kruger effect I know something, so everyone else is dumb Yo...
10561 sym 8 img
How I build up a ggplot2 figure
Recently, Jeff Leek at Simply Statistics discussed why he does not use ggplot2. He notes “The bottom line is for production graphics, any system requires work.” and describes a default plot that needs some work: library(ggplot2) ggplot(data = quakes, aes(x = lat,y = long,colour = stations)) + geom_point() To break down what is going on, her...
8061 sym R (2145 sym/25 pcs) 48 img
A Faster Scale Function
Problem Setup In recent question on LinkedIn’s R user group, a user asked “How to normalize by the row sums of the variable?”. Now first, we must define what we mean by “normalize” a matrix/data.frame. One way to standardize/normalize a row is to subtract by the mean and divide by the max to put the data into the [0, 1] domain. Many tim...
4945 sym R (4052 sym/14 pcs) 8 img