Publications by indiacrunchin
Setting up AWS Cluster to use snow in R
Setting up AWS Cluster I wanted to setup an AWS cluster to take a shot at a Kaggle contest – DunnHumby Challenge http://www.kaggle.com/c/dunnhumbychallenge For this, I found StarCluster to be of great help. It allows you to set-up AWS nodes in a few lines of code and does much more (choosing AMIs and cluster configurations) http://web.mit.edu/...
1201 sym 4 img
Missing values and column types when reading data into R
Reading data into R when dealing with column types and values that need to be considered as NA Below are code snippets to introduce a few arguments of the read.csv function in R # Create sample data strVals miscVals numVals # Scenario 1 : Pure numeric and strings dataTemp write.csv(dataTemp,file=”inputData.csv”,quote=F,row.names=F) inDat...
1512 sym 4 img
Finding functions in R
When looking for functions whose exact name is unknown # Functions related to “shrinkage” methods help.search(“shrinkage”) Package sos does a great job in finding functions install.packages(“sos”) library(sos) shrinkageResults shrinkageResults # This opens a webpage in your browser with the results The table in the webpage create...
892 sym 4 img
Sending Email from R (using sendEmail)
Like a lot of other R users I’ve felt the need for sending email from R. I haven’t surveyed CRAN for such a package but looked for the possibility of sending command line email in Windows. Found a nice application called sendEmail that can be found here Below are code snippets in R that will allow you to make use of this application. First, d...
2789 sym 4 img
GUI for sending email in R (using sendEmail)
After writing the last post on using sendEmail to send email from R I decided to create a simple GUI to enable this functionality. A snapshot image of the GUI is shown above. To use this GUI, you will need to install the following packages in R: gWidgets gWidgetsRGtk2 Windows GTK Bundle More information on installing gWidgets can be found i...
1543 sym 6 img
Path from root to leaf node in mvpart
I was recently asked by a R user about how one could extract the “rule” in a classification/regression tree. The requirement was to obtain the path traced from the root node to the leaf nodes and obtain all the paths or “rules” path.rpart() function in the mvpart package provides this convenience library(mvpart) # Create a classification...
1367 sym 4 img
Simple Text Mining with R
I’ve used R for many use cases and Text Mining is one of those. Below is a small snippet to get you started with R and Text Mining. require(fortunes) require(tm) sentences <- NULL for (i in 1:10) sentences <- c(sentences,fortune(i)$quote) d <- data.frame(textCol =sentences ) ds <- DataframeSource(d) dsc<-Corpus(ds) dtm<- DocumentTermMat...
1335 sym 16 img