2814 search results for "gis"

Functions for plotting and getting Greek in labels

October 8, 2012
By
Functions for plotting and getting Greek in labels

The problem: We often want to plot data and assign plot attributes based on characteristics of the data. For example, if we have a group of students with the following IQs, we might want to indicate who is an outlier in the statistical sense. I like...

Read more »

How to read BSMAP methylation ratio files into R via methylKit

October 5, 2012
By

BSMAP is an aligner for bisulfite sequencing reads. It outputs aligned reads as well as methylation ratios per base (via methratio.py script). The methylation ratios can be read into R via methylKit package and regular methylKit analysis can ...

Read more »

Calculating distances (across matrices)

October 5, 2012
By
Calculating distances (across matrices)

This Gist is mostly for my future self, as a reminder of how to find distances between each row in two different matrices. To create a distance matrix from a single matrix, the function dist(), from the stats package is sufficient. There are times, ho...

Read more »

Adding Measures of Central Tendency to Histograms in R

October 4, 2012
By
Adding Measures of Central Tendency to Histograms in R

Building on the basic histogram with a density plot, we can add measures of central tendency (in this case, mean and median) and a legend.Like last time, we'll use the beaver data from the datasets package.hist(beaver1$temp, # histogram col =...

Read more »

Log odds ratios and an indicator matrix from categorical data

October 4, 2012
By
Log odds ratios and an indicator matrix from categorical data

A long title, but there are a couple of handy things in this Gist. The first, and more obscure, is the conversion of a data.frame of categorical variables into a matrix of dummy/binary/indicator variables, one for each category of each original variab...

Read more »

Transforming a color scale

October 3, 2012
By
Transforming a color scale

In developing plots, I often use color (or “colour” in ggplot2 parlance) to reflect values of a third, non-X/Y, variable. Depending on the distribution of this Z variable, however, the effective color range can be narrow, making it difficul...

Read more »

Emerging as Low Vol

October 2, 2012
By
Emerging as Low Vol

Extending the series begun with When Russell 2000 is Low Vol, I thought I should take a look at Emerging Market stocks during periods of low relative volatility to the S&P 500.  So you can replicate even without access to expensive data, let

Read more »

A replacement for theme_blank()

October 2, 2012
By
A replacement for theme_blank()

ggplot2 has just hit 0.9.2, and with the change comes a new theme system. Previous versions of ggplot2 offered a theme_blank(), which was a stripped-down, essentially blank plotting canvas, but it is now deprecated. github user jrnold has produced a s...

Read more »

Connecting the real world to R with an Arduino

October 2, 2012
By
Connecting the real world to R with an Arduino

If connecting data to the real world is the next sexy job, then how do I do this? And how do I connect the real world to R? It can be done as Matt Shottwell showed with his home made ECG and a patched version of R at useR! 2011. However, there are ot...

Read more »

Example 10.4: Multiple comparisons and confidence limits

October 1, 2012
By
Example 10.4: Multiple comparisons and confidence limits

A colleague is a devotee of confidence intervals. To him, the CI have the magical property that they are immune to the multiple comparison problem-- in other words, he feels its OK to look at a bunch of 95% CI and focus on the ones that appear to exclude the null. This though...

Read more »