Download presentation
Presentation is loading. Please wait.
Published byRyan Ryan Modified over 11 years ago
1
Dr Andy Pryke - The Data Mine Ltd An Introduction to R Free software for repeatable statistics, visualisation and modeling Dr Andy Pryke, The Data Mine Ltd Andy@AndyPryke.com
2
Dr Andy Pryke - The Data Mine Ltd Outline 1. Overview What is R? When to use R? Wot no GUI? Help and Support 2. Examples Simple Commands Statistics Graphics Modeling and Mining SQL Database Interface 3. Going Forward Relevant Libraries Online Courses etc.
3
Dr Andy Pryke - The Data Mine Ltd What is R? Open source, well supported, command line driven, statistics package 100s of extra packages available free Large number of users - particularly in bio-informatics and social science Good Design - John Chambers received the ACM 1998 Software System Award for S Dr. Chambers' work "will forever alter the way people analyze, visualize, and manipulate data…
4
Dr Andy Pryke - The Data Mine Ltd When Should I Use R? To do a full cycle of: –data import –data pre-processing –exploratory statistics and graphics, –modeling and data mining –report production –integration into other systems. Or any one of these steps - i.e. just to standardise pre-processing of data
5
Dr Andy Pryke - The Data Mine Ltd Wot no GUI? or The Advantages of Scripting Repeatable Debug-able Documentable Build on previous work Automation –Report generation –Website or system integration –Links from Perl, Python, Java, C, TCP/IP….
6
Dr Andy Pryke - The Data Mine Ltd Help and Support Built in help/example system (e.g. type ?plot) Many tutorials available free R-Help mailing list -Archived online -Key R developers respond -Contributors understand statistical concepts Large User Community
7
Dr Andy Pryke - The Data Mine Ltd Simple Commands 1+1 2 10*3 30 c(1,2,3) 1 2 3 c(1,2,3)*10 10 20 30 x <- 5 x*x 25 exp(1) 2.718282 q() Save workspace image? [y/n/c]: n
8
Dr Andy Pryke - The Data Mine Ltd colnames(iris) "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width "Species" plot(iris$Sepal.Length, iris$Petal.Length) # Pearson Correlation cor(iris$Sepal.Length, iris$Petal.Length) 0.8717538 # Spearman Correlation cor(rank(iris$Sepal.Length), rank(iris$Petal.Length)) 0.8818981 Simple Statistics
9
Dr Andy Pryke - The Data Mine Ltd Blueberry Cherry Apple Boston Cream Other Vanilla Cream January Pie Sales Graphics
10
Linear Models ## Scatterplot of Sepal and Petal Length plot(iris$Sepal.Length, iris$Petal.Length) ## Make a Model of Petals in terms of Sepals irisModel <- lm(iris$Petal.Length ~ iris$Sepal.Length) ## plot the model as a line abline(irisModel)
11
Dr Andy Pryke - The Data Mine Ltd Classification Trees # Model Species irisct <- ctree(Species ~., data = iris) # Show the model tree plot(irisct) # Compare predictions table(predict(irisct), iris$Species)
12
Dr Andy Pryke - The Data Mine Ltd SQL Interface Connect to databases with ODBC library("RODBC") channel <- odbcConnect("PostgreSQL30w", case="postgresql") sqlSave(channel,iris, tablename="iris") myIris <- sqlQuery(channel, "select * from iris")
13
Dr Andy Pryke - The Data Mine Ltd Data Mining Libraries (i) RandomForest –Random forests - Robust prediction Party –Conditional inference trees - Statistically principled –Model-based partitioning - Advanced regression –cForests - Random Forests with ctrees e1071 –Naïve Bayes, Support Vector Machines, Fuzzy Clustering and more...
14
Dr Andy Pryke - The Data Mine Ltd Data Mining Libraries (ii) nnets –Feed-forward Neural Networks –Multinomial Log-Linear Models BayesTree –Bayesian Additive Regression Trees gafit & rgenoud –Genetic Algorithm based optimisation varSelRF –Variable selection using random forests
15
Dr Andy Pryke - The Data Mine Ltd Data Mining Libraries (iii) arules –Association Rules (links to C code) Rweka library –Access to the many data mining algorithms found in open source package Weka dprep –Data pre-processing –You can easily write your own functions too. Bioconductor –Multiple packages for analysis of genomic (and biological) data
16
Dr Andy Pryke - The Data Mine Ltd Sources of Further Information Download these slides + the examples & find links to online courses in R here: http://www.andypryke.com/pub/R
17
Dr Andy Pryke - The Data Mine Ltd
18
Editors which Link to R Rgui (not really a GUI) Emacs (with ESS mode) RCmdr Tinn-R jgr - Ja SciViews and more...
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.