learning r and teaching r

Post on 23-Aug-2014

2.181 Views

Category:

Science

8 Downloads

Preview:

Click to see full reader

DESCRIPTION

 a brief tutorial to learning R an teaching R including navigating syntax, documentation and interfaces

TRANSCRIPT

Learning Rand Teaching R

TodayTitle: R Language and Analytics as a Profession

Agenda:

1 hour hands on R coding (beginner/intermediate level)

1 Hour talking on Analytics as a Profession

Speaker: Mr. Ajay Ohri

Venue: Room No: 511, Department of Management studies (DMS), Vishwakarma Bhawan, IIT Delhi – 110016

Date & Time: 14 June 2014, Saturday 14.30 – 16:30 Hrs

Directions to Reach the Venue:

Option A: You need to get down at Malviya Nagar/Hauz Khas Metro station and ask auto to take you just near Katwariya Sarai.

Option B: Get down at Hauz Khas Metro Station. Take Bus (511 or 511A or Battery PoweredRickshaw to reach to Sanskrit Vidya peeth (near Katwaiya Sarai ).

Or Take Bus 764 and get down at IIT Hostel Gate. Walk a bit to reach DMS.

PLEASE NOTE-

DMS or IIT Delhi has no role in organizing this event.

New Delhi R Meetuphttp://www.meetup.com/New-Delhi-R-UseR-Group/298 members2 YearsSponsored

Non Commercial Group Only

Introduction● Learning R

○ R Console○ R Studio○ R GUIs○ R Cloud

● Teaching R

R from the Console● limited lines of code can submitted at a time● one graph can be viewed at a time● best for either beginners or really command line users● no syntax prompting● help is in a separate window

R Syntax- most important- # adding a hash or # comments out rest of sentencecomments make your code more readable

-?(keyword) looks for help on that keyword locally

-??(keyword) looks for help on that keyword in all the documentationAssignment

● objectname1=subset(df,df.name$var1 )

My first 25 R Commands What’s here?

● ls()● getwd()● setwd()● dir()● rm()

What’s in my object?● str()● class()● dim()● length()● names()● nrowl() # and ncol()

How do I select or change stuff● data.frame.name$variable● data.frame[row,column]● subset(df,df.name$var1 > X & df$var2 <Y | df$var3 ==” text”)

Function● function1=function(x,y,z){x^2+2x*y+(z/10)-23}

Math● log(x)● mean(x)● sd(x)● median(x)● exp(x)

Packages● install.package(“FOO”)● library(FOO)● update.package()

What can I do?● read.table()● write.table()● summary()● table()● plot()● hist()● boxplot()● library(Hmisc) describe()● library(Hmisc) summarize()

Install from CRAN

Downloading

Installation

Dependencies and Loading

Dependencies and Loading

My next 25 R Commands What’s missing?

● is.na()● na.omit()● na.rm=T

Operators● diff● lag● cumsum

Data Mining ● kmeans● arules::apriori ● tm::tm_map

References- http://www.statmethods.net/advstats/cluster.html

http://cran.r-project.org/web/packages/arulesViz/vignettes/arulesViz.pdf

http://cran.r-project.org/web/packages/tm/vignettes/tm.pdf

http://www.rdatamining.com/examples/association-rules

Modeling● cor(x)● lm(x)● vif(a)● outlierTest(a)

System ● system.time()● Sys.Date()● Sys.time()

What more can I do?● b=ajay[sample(nrow(ajay),replace=F,

size=0.05*nrow(ajay)),]

● png(“graph.png”) Write plot as png

file

● dev.off

Data Manipulation● as operator● substr● nchar● paste● difftime● strptime● lubridate::mdy● apply functions

My favorite 15 R Packages

Data Mining● tm● arulesViz● forecast

GUIs● rattle● Rcmdr

○ epack plugin○ KMggplot2 plugin

● Deducer

Visualization● ggplot2● ggmap

Data Handling● Dates- lubridate ● Analysis - Hmisc● Rcurl● XML● jsonlite

Some more R packages

slidifyhttp://slidify.org/

quantmodhttp://www.quantmod.com/

rocrhttp://rocr.bioinf.mpi-sb.mpg.de/

r chartshttp://rcharts.io/

My favorite R documentation

CRAN Viewshttp://cran.r-project.org/web/views/

R Documentationhttp://www.rdocumentation.org/

Inside Rhttp://www.inside-r.org/

R Documentation

Views

Stack Overflow

Stack Overflow - for R

Interfaces to R

R Studio -IDEGUIs - RCommander, rattle, DeducerOnline- R-fiddle, statace

Rattle GUI for Data Mining

RStudio

Rcmdr

Rcmdr

JGR

JGR

JGR with Deducer -Data Viz

R-Fiddle

Statace

Teaching RMultiple ways to do the same thing in R - Resolve CONFUSIONGUIs can be shortcut initially -Selective Introduction to PackagesWill need command line and ?help later on -Emphasizing documentation

Pace of learning to be as per audienceHuge Scope- hence should be kept pertinent to needs

Analytics is not StatisticsR is more than a computer language or syntaxProjects are the best teachers

R Project for Researchers

● creating packages for analytics relevant to industry ○ i.e telecom churn, rfm, ltv, retail

● any takers?

Thanks

Contact-

https://www.linkedin.com/in/ajayohriat ohri2007 @ gmail.com

top related