## Fuzzy clustering with fanny()

December 13, 2012
By

This is kind of a fun example, and you might find the fuzzy clustering technique useful, as I have, for exploratory data analysis. In this Gist, I use the unparalleled breakfast dataset from the smacof package, derive dissimilarities from breakfast it...

## Creating 2011 Census Output Area Change Maps Using R

December 13, 2012
By

The 2001 Census used a different set of Output Areas (OA) than the current 2011 boundaries; reflecting changes in the spatial distribution of the underlying population. For example, if an area has become more heavily populated since 2001, it makes sense that a previous OA might be split into multiple new segments. The ONS have provided

## Creating 2011 Census Output Area Change Maps Using R

December 13, 2012
By

The 2001 Census used a different set of Output Areas (OA) than the current 2011 boundaries; reflecting changes in the spatial distribution of the underlying population. For example, if an area has become more heavily populated since 2001, it makes sense that a previous OA might be split into multiple new segments. The ONS have provided both...

## Is invasive?

December 13, 2012
By

The Global Invasive Species Database (GISD) (see their website for more info here) has data on the invasiveness status of many species. From taxize you can now query the GISD database. Introducing the function gisd_isinvasive. This function was contributed to taxize by Ignasi Bartomeus, a postdoc at the Swedish University Agricultural Sciences. There are two possible outputs from using...

## Is invasive?

December 13, 2012
By

The Global Invasive Species Database (GISD) (see their website for more info here) has data on the invasiveness status of many species. From taxize you can now query the GISD database. Introducing the function gisd_isinvasive. This function was contributed to taxize by Ignasi Bartomeus, a postdoc at the Swedish University Agricultural Sciences. There are two possible outputs from using...

## Creating 2011 Census Output Area Change Maps Using R

December 12, 2012
By

The 2001 Census used a different set of Output Areas (OA) than the current 2011 boundaries; reflecting changes in the spatial distribution of the underlying population. For example, if an area has become more heavily populated since 2001, it makes sense that a previous OA might be split into multiple new segments. The ONS have provided both...

## more d3 with shiny and R (CPI from bls.gov)

December 12, 2012
By

Extending the marginal success achieved in d3 Showreel Combined with R and Shiny  d3 and r interacting through shiny I have converted http://bl.ocks.org/3891711 to use data supplied by an R load of http://bls.gov CPI data through Rstudio's Shin...

## In case you missed it: November 2012 Roundup

December 12, 2012
By

In case you missed them, here are some articles from November of particular interest to R users. In the webinar "Real-Time Predictive Analytics with Big Data", I showed how R fits into a real-time production system. R package developer Yihui Xie shares his favorite software and hardware in an interview with The Setup. Hadley Wickham created a handy tutorial...

## Survival of the sweetest

December 12, 2012
By

On receiving an advent calendar from one of our course directors, I suggested we could track each other’s chocolate consumption in a survival analysis and establish who was eating significantly more chocs. Strangely, everybody refused to take part, so I … Continue reading →

## How to plot a network (package network) – Tip 2

December 12, 2012
By

As you have certainly seen now, I like working on artificial neural networks. I have written a few posts about models with neural networks (Models to generate networks, Want to win to Guess Who and Study of spatial segregation).Unfortunately, I missed ...

## Using R to refine the search result of www.finn.no

December 12, 2012
By

www.finn.no is the most popular website in Norway. It supplies a lot of features, such as booking flight tickets, finding job, renting and sales of houses, cars and other properties, etc. I just have some experience with it. I sold and bought cars, apartment and some other stuff. It’s very convenient. But just one thing I feel not convenient:...

## Multidimensional metric unfolding with SMACOF

December 12, 2012
By

SMACOF stands for “Scaling by MAjorizing a COmplicated Function,” and it is a multidimensional scaling algorithm for metric unfolding of, among other things, rectangular ratings matrices. One neat Political Science application of MDS is i...

## Exporting Data From R to KDB

December 12, 2012
By

Here is the beginnings of a simple routine to convert R data frames to Q format (in this case a dictionary). It uses the S3 dispatch mechanism to handle the conversion of different data types. Extremely basic (I havent even … Continue reading →

## French R Conference in Lyon – call for contributions

December 12, 2012
By

La prochaine édition des Rencontres R aura lieu à Lyon en Juillet prochain. Ci-dessous, l’appel officiel à contributions. ————————————————– Appel à communication des 2èmes Rencontres R : Dans la lignée de la conférence internationale Use’R et suite à la première édition qui a eu lieu à Bordeaux

## project euler — problem 68

December 12, 2012
By

Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine. Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the...

## Clarifying a Previous Item Response Theory Link

December 11, 2012
By

I wanted to thank those of you who have emailed and commented on my last post and its Link to Item Response Theory Presentations Using R.  In the Psychometrics Centre website, it is not until Topic 7 called Unidimensional IRT models for binar...

## Multidimensional scaling of REM album covers: FlagSpace revisited

December 11, 2012
By

By way of following up on an old in-joke, and doing something constructive because I couldn’t get to sleep, I thought I would revisit the Flag Space plot that I blogged about a while back and learn how to do it. … Continue reading →

## Videos from Coursera’s four week course in R

December 11, 2012
By

Coursera's Computing for Data Analysis course on R is now over, with four weeks of free, in-depth training on the R language. While you'll have to wait for the next installment of the course to participate in the full online learning experience, you can still view the lecture videos, courtesy of course presenter Roger Peng's YouTube page. The course...

## 2012-12 Post-Processing grid Graphics

December 11, 2012
By

Statistical plots drawn with the ggplot2 package generate numerous grid grobs and viewports which are labelled and organised into a coherent hierarchy. This report describes an example that shows how to manipulate the grobs and viewports in a ggplot2 plot … Continue reading →

## Music Network Visualization

December 11, 2012
By

Note: probably of interest only to the intersection of the readers who are into niche music genres and those interested in network visualization. My music interests have always been rather, hmm…, eclectic. Somehow IDM, ambient, darkwave, triphop, acid jazz, bossa … Continue reading →

## Estimating Pi

December 11, 2012
By

Recently I’ve been working on some jackknife and bootstrapping problems.  While working on those projects I figured it would be a fun distraction to take the process and estimate pi.  I’m sure this problem has been tackled countless times but I have never bothered to try it using a Monte Carlo approach.  Here is the

## Visualizing Baltimore 3.1: Crime and Vacant Properties, Neighborhood Level, Bit More Polished

December 11, 2012
By

Redos of the plots from this post: Bit more communicative, though the overplotting is a bit annoying. Code: ## gis libraries library(spBayes) library(MBA) library(geoR) library(fields) library(sp) library(maptools) library(rgdal) library(classInt) library(lattice) library(xtable) library(spatstat) library(splancs)   ## Other packages library(ggplot2) library(foreign) library(stringr)...

## Gmail went down. Nobody panic.

December 11, 2012
By

Source: 1500 random tweets from today with the terms 'gmail down' (pulled from API).

## Linear Models with Multiple Fixed Effects

December 11, 2012
By
$Linear Models with Multiple Fixed Effects$

Estimating a least squares linear regression model with fixed effects is a common task in applied econometrics, especially with panel data. For example, one might have a panel of countries and want to control for fixed country factors. In this case the researcher will effectively include this fixed identifier as a factor variable, and then proceed to

## R Tip: Avoid using T and F as synonyms for TRUE and FALSE

December 11, 2012
By

By default when you start R, T and F are defined as TRUE and FALSE. When I review other people’s code, I often see functions defined with arguments set to these values by default. This is a very bad idea. … Continue reading →

## US State Maps using map_data()

December 11, 2012
By

Today’s short post will show how to make a simple map using map_data(). Let’s assume you have data in a CSV file that may look like this: Notice the lower case state names; they will make merging the data much easier. The variable of inte...

## Split strings based on a character in the string

December 11, 2012
By

R has various facilities for string manipulation including the strsplit function to divide a string into substrings based on matching to another string. A simple example is shown below > strsplit("<td class=\"objectName\"><a href=\"/path/test.html\" target=\"\" title=\"An Object\" class=\"myObject\">Stuff</a></td>", "<") ] "" "td class=\"objectName\">" "a href=\"/path/test.html\" target=\"\" title=\"An Object\" class=\"myObject\">Stuff" "/a>" "/td>"

## Comparing regions: maps, cartograms and tree maps

December 11, 2012
By

Last week I attended a seminar where a talk was given about the economic opportunities in the SAAAME (South-America, Asia, Africa and Middle East) regions. Of course a map was shown with those regions highlighted. The map was not that disimilar to the one below. library(RColorBrewer)library(rworldmap)data(countryExData)par(mai=c(0,0,0.2,0),xaxs="i",yaxs="i")mapByRegion( countryExData, ...

## New website!

December 11, 2012
By

This is my new website! It’s built using jekyll-bootstrap and hosted on Github.