The objective is to use D3JS’ network visualisation to cluster groups of nodes based on the link value. The full code and output of this example can be found here. First, I started with heybignick’s awesome network which itself is an adaptation of Mike Bostock’s network – but with node labels. The bit that we […]

# Tag: data science

## Plotting an equation – R

This is how you plot an equation in R. The equation we are going to plot is a simple one. y = x– 1 The first thing we do is set the value for x by creating a sequence from 0 to 1 at 0.01 intervals Now we can get the y values so if […]

Here are a few stats about all Android ROM related posts submitted to the XDA developers forum since Jan 2010. It shows three of the most talked about Android modification projects: CyanogenMod, AOKP, and MIUI. Observations are as follows. CyanogenMod AOKP MIUI Forum Members 26,185 9,268 11,488 Posts 93,408 30,790 39,604 Forum Threads 2,221 697 […]

## Sorting Vectors – R

A very quick reminder to myself on how to take data from a data frame, place them into vectors, then sort them from highest to lowest. The Data Frame The data frame now looks like this Create Vector Get all the subs and create a vector for a bar plot. we should get something like […]

This function will color all the nodes that are isolated in red. It will also draw the graph using the circle layout. No time to explain. Sorry. The Function

## Inequality and Lorenz Curve – R

Inspired by the train-wreck that was yesterday’s post, I was able to find a better solution to calculating inequality and plotting Lorenz Curves using the ineq library in R. EDIT: gini() in the reldist package also works. Installing and loading the Library Download and install Now load the library The Data I have a frequency […]

The method, based on Kevin Crowston et al’s “Core and Periphery” paper, is explained in greater detail here. This is the same as the other post, but it is now in a more convenient function form. The R Function To run the function you need to first load a file with all the user names […]

This R function will draw a graph and then colour the nodes according to centrality. There are three colours, red for high centrality, purple for medium centrality, and blue for low centrality. Node centrality was calculated using the betweenness( ) function in the igraph R library. It was then normalised manually so that we are […]

## Ordering Rows in a Data Frame – R

How to re-arrange the rows in a Data Frame using the values in a column. First we must build the data frame. Build Data Frame This data frame will have two columns, one for names and one for ages. We shall call it `df’ Now we can put both vectors into the data frame. Ascending […]

## Scatter Plot with Log Scale – R

Get a Frequency Count The user file looks like this First thing is to read the file Then we get the frequency count The frequency count should now return something like this Building the Scatter Plot We need to use Freq as the x coordinates and Var1 as the y coordinates. Now a simple scatter […]