Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Sunday, April 7, 2013

Top 10 tips to get started with R

(This article was first published on mages' blog, and kindly contributed to R-bloggers)

  1. Be motivated. R has a steep learning curve. Find a problem you can't solve otherwise. E.g. plotting multivariate data, a statistical analysis for which an R function exists already.
  2. Download and install R. Get to know the R console. Learn how to install additional packages, how to access the history, how to use auto completion and open the help system. Review the R Installation and Administration manual and check out the free books section on CRAN. 
  3. Get familiar with the R help files. They can appear cryptic at the start, but there is a structure to them. Read and re-read a couple of help files again and again. Look out for the input and output sections, execute the examples, run the demos, e.g.demo(graphics). Subscribe to R-help and read questions and answers, check outstackoverflow, follow blogs. Search with Rseek.org. 
  4. Learn how to get your data into R. The easiest way is usually via a CSV-file (CSV=comma separated values), using read.csv. Look into XLConnect, if you have to deal with spreadsheet files. Move on to write queries against data bases, e.g. using RODBC. Skim through the R Data Import/Export manual. 
  5. Try to understand the different data types in R and how to modify them. What are the differences between a matrix and a data frame? What is a factor? What is a list? Think about the different use cases. Review the Introduction to R manual.
  6. Do charts! Lots of charts. They are rewarding and keep you motivated. Be inspired by the R Graph Gallery. Check out the following packages: lattice, plotrix, ggplot2,deducer, googleVis.
  7. Learn how you can modify and reshape data in R and apply functions on subsets using by, apply, lapply, ave, reshape, sweep, with, within, etc. Set aside a weekend to think about these functions. 
  8. Write your R code into files instead of typing it all into the R console. Use anintegrated development environment (IDE), e.g. ESS Emacs, RStudio, StatET Eclipse.
  9. Understand the concept of functions. Write a function, which gives "Hello World" back. Modify it, so it has an input argument NAME and it prints "Hello NAME". Review the code of existing R functions. Copy from existing code.
  10. Document your code! Start your code by explaining what you want to achieve and only code that much, then write down the next step in plain English and code again. How will you know that your code does what you want it to do? Testing can help. Think your about your code style and how you will be versioning your files.

Bonus tip


To leave a comment for the author, please follow the link and comment on his blog:mages' blog.
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX,SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series,ecdf,trading) and more...

Thursday, December 13, 2012

meaning forecast

robjhyndman.com пишет про новый R пакет прогнозирования как бе, но пишет следующим образом:
The accuracy func­tion now works with both time series fore­casts and cross-​​sectional forecasts. то-есть, по-руски прогнозирование -- это предвидение по времени, а попе н достансге -- совсем не обязательно и вводит нас (если на демографическом образовании строицо) в мир indirect techniques

Wednesday, December 5, 2012

Multivariate regression analysis using categorical explanatory variables

LinkedIN начал новую нитку с этой назвой

Which package is useful to handle categorical variables in a multivariate regression analyisis and where may I find the tutorials? Every information that I find is about quantitative data.
I am currently using a lm function to find the best predictor for a quantitative response variable but I am afraid, it is not the best approach. I also do not want to use dummies.

Thursday, April 26, 2012

Tutorials from Universities Around the World


Online tutorials for R programming, Statistics and Graphic

Here is a list of FREE R tutorials hosted in official website of universities around the world. The tutorials are listed  in no particular order, actually based on when I have discovered it. They will be categorised soon. Please kindly suggest me other university-hosted online R tutorials by email to me@pairach.com.
  1. University of California at Davis,
    Getting Started with the R Data Analysis Package
    by Professor Norm Matloff
  2. Clarkson University,
    R Tutorial
    by
     Kelly Black
  3. York University,
    Getting started with R
  4. University of Waterloo
    R Tutorial For A WINDOWS Environment (Windows, Unix)
  5. University of California at Los Angles, UCLA,
    Resources to help you learn and use R
  6. University of California at Riverside.
    Programming in R
  7. University of Illinois,
    A Brief Introduction to R
  8. University of Texas at Austin,
    R Tutorial Videos
    by Brandon K. Vaughn
  9. University of California at Berkeley,
    An Introduction to R (PDF)
    by Phil Spector
  10. University of California at Santa Babara,
    R Programming Resource Centre
    by National Center for Ecological Analysis and Synthesis
  11. Chiang Mai University,
    Econometrics with R (in Thai)
    by Pairach Piboonrungroj.
  12. University of Carnegie Mellon,
    A Tutorial: Some Fundamentals of R.
    by Bruce E. Trumbo
  13. University of Illinois State,
    R Tutorial.
    by Dong-Yun Kim
  14. University of MacMaster,
    Introduction to the R Statistical Computing Environment.
    by John Fox.
  15. University of Princeton,
    Introducing R.
    by Germán Rodríguez
  16. University of Amsterdam,
    How to draw graphs with R,  [Graphics]
    by A.M. (Angelos-Miltiadis) Krypotos
  17. University of North Texas,
    Do it yourself – Introduction to R [Intro]
  18. University of Warwick,
    R programming page [Biosciences: Molecular Organisation and Assembly in Cells]
    by Peter Cock.
  19. University of Illinois at Urbana-Champaign
    R tutorial for Applied Econometrics
    by Prof. Roger Koenker
  20. Coastal Carolina University
    R tutorials [General]
    by  William B. King
  21. University of Colorado Denver
    R Tutorial [General]
    by  Stephanie Santorico and Mark Shin
  22. Stanford School of Medicine (Biomedical Informatics)
    R Tutorial [VDO on Introduction + Translational Bioinformatics]
  23. Harding University
    Producing Simple Graphs with R [basic graphic e.g., line, bar, hist, line]
    by Frank McCown
  24. University of Kentucky, Department of Statistics
    Use Software R to do Survival Analysis and Simulation [pdf]
    by Mai Zhou

Monday, November 7, 2011

Rlinx

Some useful R links (State of the R)

http://had.co.nz/plyr/plyr-intro-090510.pdf for data manipulation
http://www.stats.ox.ac.uk/~ruth/RCourse/Rcourse3.pdfhttp://cran.r-project.org/doc/contrib/usingR.pdf for R basics
http://www.ats.ucla.edu/stat/r/dae/default.htm with annotated outputs in R
http://cran.r-project.org/doc/contrib/Rossiter-RIntro-ITC.pdf tutorial with info on plots
http://www.statmethods.net/stats/regression.htmlhttp://www.rmetrics.org/ provides an Open Source framework for Financial Analysis.
http://www.econ.uiuc.edu/~econ472/e-Tutorial.html has lecture notes with R code
A brief guide to R and Economicshttp://people.su.se/~ma/R_intro/R_intro.pdfhttp://www.stat.pitt.edu/stoffer/tsa2/index.html has a good beginner’s tutorial for Time Series
http://www.quantmod.com/ provides a great analysis and visualization framework for quantitative trading
http://www.wise.xmu.edu.cn/2007summerworkshop/download/Advanced%20Topics%20in%20Time%20Series%20Econometrics%20Using%20R1_ZongwuCAI.pdf advanced time series in R
Interesting time series packages in R http://robjhyndman.com/software
A Data Mining tool in R http://rattle.togaware.com/
An online e-book for Data Mining with R http://www.liaad.up.pt/~ltorgo/DataMiningWithR/
Advanced Statistics using R http://www.statmethods.net/advstats/index.html
Guide to Credit Scoring using R http://cran.r-project.org/doc/contrib/Sharma-CreditScoring.pdfhttp://addictedtor.free.fr/graphiques/ is a graph gallery of R plots and charts with supporting code
A tutorial for Latticehttp://osiris.sunderland.ac.uk/~cs0her/Statistics/UsingLatticeGraphicsInR.htm
Ggplot R graphics http://had.co.nz/ggplot2/
Ggplot Vs Lattice @ http://had.co.nz/ggplot/vs-lattice.html
Multiple tutorials for using ggplot2 and Lattice http://learnr.wordpress.com/tag/ggplot2/
Introduction to the Text Mining package in R http://cran.r-project.org/web/packages/tm/vignettes/tm.pdf
Social Network Analysis http://www.r-project.org/conferences/useR-2008/slides/Bojanowski.pdf
Web Scraping in R http://www.programmingr.com/content/webscraping-using-readlines-and-rcurlhttp://learnr.wordpress.com/2009/10/06/export-data-frames-to-multi-worksheet-excel-file/ to embed R data frames in Excel via multiple approaches.
http://www.statconn.com/ provides a tool to make R usable from Excel
Connect to MySQL from R http://erikvold.com/blog/index.cfm/2008/8/20/how-to-connect-to-mysql-with-r-in-wndows-using-rmysqlhttp://www.statmethods.net/input/importingdata.htmlprovides info about pulling data from SAS, STATA, SPSS, etc.
Thematic Maps with R http://stackoverflow.com/questions/1260965/developing-geographic-thematic-maps-with-rhttp://smartdatacollective.com/Home/22052 for geographic maps in R
Google Charts with Rhttp://www.iq.harvard.edu/blog/sss/archives/2008/04/google_charts_f_1.shtml
Intro to using RGoogleMaps @ http://cran.r-project.org/web/packages/RgoogleMaps/vignettes/RgoogleMaps-intro.pdfhttp://www.stat.uni-muenchen.de/~leisch/Sweave/
R2HTML http://www.feferraz.net/en/P/R2HTML
Poor Man GUI for R http://wiener.math.csi.cuny.edu/pmg/
R Commander is a robust GUI for R http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html
JGR is a Java-based GUI for R http://jgr.markushelbig.org/Screenshots.html
Tinn-R makes for a good R editor http://www.sciviews.org/Tinn-R/
An Eclipse plugin for R @ http://www.walware.de/goto/statet
Instructions to install StatET in Eclipsehttp://www.splusbook.com/Rintro/R_Eclipse_StatET.pdf
Komodo Edit R editor http://www.sciviews.org/SciViews-K/index.htmlhttp://www.omegahat.org/has a very interesting list of packages that is seriously worth a look
Commercial versions of R @ http://www.revolution-computing.com/
A very informative blog http://blog.revolution-computing.com/
Red R for R tasks http://code.google.com/p/r-orange/
KNIME for R http://www.knime.org/introduction/screenshots and is worth a serious look.
source: LinkedInRGroup with more

Monday, May 2, 2011

Nets-Dats

Social Network Analysis Labs in R and SoNIA

McFarland, Daniel A., Solomon Messing, Michael Nowak and Sean J. Westwood.
To run the following labs install R (Linux, MacOS X or Windows) and execute the following command in R (this will download and install all needed packages and data):
source("http://sna.stanford.edu/setup.R")

Chapters

1. “Introductory Lab.” Nowak, Michael and Daniel A. McFarland. 2010.
2. “Methodological Beginnings – Basic Triadic and Cohesion Measures.” Nowak, Michael and Daniel A. McFarland. 2010.

3. “Clusters, Factions and Cores.” Nowak, Michael and Daniel A. McFarland.

4. “Centralities and Their Interrelation.” Sukumaran, Abhay,Michael Nowak and Daniel A. McFarland.

5. "Affiliation Data and Network Mobility." Messing, Solomon and Daniel A. McFarland. 2010.

6. "Structural Equivalences and Block-Modeling." Nowak, Michael, Solomon Messing, Sean J. Westwood and Daniel A. McFarland. 2010.

7. “Peer Influence and QAP Regression." Messing, Solomon, Sean J. Westwood and Daniel A. McFarland. 2010.
8. "Exponential-Family Random Graph Models.” Westwood, Sean J. and Daniel A. McFarland. 2010.
9. "Converting igraph to SoNIA with R." Westwood, Sean J. and Daniel A. McFarland. 2010.
10. "rSoNIA and Visualizing Social Network Dynamics." Bender-deMoll, Skye and Daniel A. McFarland. 2010.

Additional software

SoNIA is a Java-based package for visualizing dynamic or longitudinal "network" data. (This is a temporary download meant to fix SoNIA while a new release is under work)
Software required to run SoNIA:
Acknowledgements: Special thanks to Skye Bender-deMoll and James Moody. An earlier version of the introductory lab, the Exponential Random Graph Model lab, and rSoNIA lab were developed in collaboration with them. We have revised, extended and reorganized the content of those labs here.
This material is based upon work supported by the Office of the President at Stanford University and the National Science Foundation under Grants No. 0835614 and 0624134. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of Stanford University or the National Science Foundation.