R code

Le Monde puzzle [#8]

March 29, 2011 | xi'an

Another mathematical puzzle from Le Monde that relates to a broken calculator (skipping the useless tale): Given a pair of arbitrary positive integers (x,y) a calculator can either substract the same integer [lesser than min(x,y)] from both x and y or multiply either x or y by 2. ... [Read more...]

Copula Functions, R, and the Financial Crisis

March 10, 2011 | Matt Bogard

From: In defense of the Gaussian copula, The Economist"The Gaussian copula provided a convenient way to describe a relationship that held under particular conditions. But it was fed data that reflected a period when housing prices were not correlated to the extent that they turned out to be when ...
[Read more...]

Merging Multiple Data Frames in R

January 23, 2011 | Matt Bogard

Earlier I had a problem that required merging 3 years of trade data, with about 12 csv files per year. Merging all of these data sets with pairwise left joins using the R merge statement worked (especially after correcting some errors pointed out by Ha...
[Read more...]

Flexibility of R Graphics

January 21, 2011 | Matt Bogard

(note scroll all the way down to see 'old code' and 'new more flexible code' Recall and older post that presented overlapping density plots using R (Visualizing Agricultural Subsidies by KY County) see image below.The code I used to produce this plot m...
[Read more...]

Posted Question for R Users

January 21, 2011 | Matt Bogard

I recently undertook a project where a colleague had about 12 .csv files that they wanted to merge. Each file had a common (key) variable 'Partner' (which is trading partner) with differing columns (variables) except for the common key variable. Actual...
[Read more...]

R Code Documentation Template

January 15, 2011 | Matt Bogard

# *------------------------------------------------------------------# | PROGRAM NAME: # | DATE: # | CREATED BY: # | PROJECT FILE: # *----------------------------------------------------------------# | PURPOSE: # |# *-------...
[Read more...]

R Code for googleVis Demo

January 12, 2011 | Matt Bogard

# ------------------------------------------------------------------# | PROGRAM NAME: googleVis_R# | DATE: 1/12/11 # | CREATED BY: Matt Bogard# | PROJECT FILE: # |----------------------------------------------------------------# | PURPOSE: ...
[Read more...]

R Code Example for Neural Networks

December 12, 2010 | Matt Bogard

See also NEURAL NETWORKS. In this past June's issue of R journal, the 'neuralnet' package was introduced. I had recently been familiar with utilizing neural networks via the 'nnet' package (see my post on Data Mining in A Nutshell) but I find the neuralnet package more useful because it will ...
[Read more...]

Le Monde puzzle [34]

October 3, 2010 | xi'an

Since the puzzle in this week (-end) edition of Le Monde is not (easily) solvable via an R program, I chose to go back to an older puzzle that my students can solve. Eleven [distinguishable] token are [arbitrarily] distributed around a 200 meter perimeter-long ring. They all start moving at the ... [Read more...]

Data Mining in A Nutshell

September 20, 2010 | Matt Bogard

# The following code may look rough, but simply paste into R or# a text editor (especially Notepad++) and it will look# much better.# PROGRAM NAME: MACHINE_LEARNING_R# DATE: 4/19/2010# AUTHOR : MATT BOGARD# PURPOSE: BASIC EXAMPLES OF MACHINE LEAR...
[Read more...]

R Code Examples

September 19, 2010 | Matt Bogard

Data Mining in a Nutshell 'neuralnet'  neural network estimation and visualizationVisualizing Agricultural Subsidies by KY County R Code For googleVis  Data Visualization
[Read more...]

Taking R to the Limit: Parallelization

July 29, 2010 | Szilard

Video, slides and code of the talk “Taking R to the Limit: Parallelization” by Ryan Rosario at the Los Angeles area R Users Group in July 2010 as follows. Slides: R code: here. Video: If you have a question to … Continue reading →
[Read more...]

Clustergram: visualization and diagnostics for cluster analysis (R code)

June 15, 2010 | Tal Galili

About Clustergrams In 2002, Matthias Schonlau published in “The Stata Journal” an article named “The Clustergram: A graph for visualizing hierarchical and . As explained in the abstract: In hierarchical cluster analysis dendrogram graphs are used to visualize how clusters are formed. I propose an alternative graph named “clustergram” to examine how ... [Read more...]

formatR: farewell to ugly R code

April 13, 2010 | Yihui Xie

It is not uncommon to see messy R code which is almost not human-readable like this: # rotation of the word "Animation" # in a loop; change the angle and color # step by step for (i in 1:360) { # redraw the plot again and again plot(1,ann=FALSE,type="n",axes=FALSE) # rotate; use ... [Read more...]

Correlation scatter-plot matrix for ordered-categorical data

April 7, 2010 | Tal Galili

When analyzing a questionnaire, one often wants to view the correlation between two or more Likert questionnaire item’s (for example: two ordered categorical vectors ranging from 1 to 5). When dealing with several such Likert variable’s, a clear presentation of all the pairwise relation’s between our variable can be ... [Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)