Skip to main content

Programming in R

  • Chapter
  • First Online:
The R Software

Part of the book series: Statistics and Computing ((SCO,volume 40))

Abstract

The strength of the R system is that it includes a real programming language. We shall see that it offers very original programming concepts. The concept of objects is very present in R. Object-oriented programming as used in R is transparent for the user, in the sense that you do not need to understand the theory in order to use it. The same cannot be said for the developer who wishes to respect the spirit of R.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 139.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 179.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 179.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    See for example http://en.wikipedia.org/wiki/Ordinary_least_squares.

  2. 2.

    The function missing() is also very useful for this kind of programming.

  3. 3.

    It should be noted that many programming languages do not have this functionality.

  4. 4.

    In fact, this group of operators can be used by a user when developing a new class of objects. But this matter is too advanced for this book!

  5. 5.

    To see this, type in the command line apropos("<-").

  6. 6.

    The core of R is developed in the C language for obvious reasons of speed of execution, which makes it rather reactive when used in the command line.

  7. 7.

    To speed up execution, it is usually possible to convert an R function into C and then to call it from R via the C API.

  8. 8.

    In fact, for auto-printing base objects (vectors, matrices, lists, etc.) in the console, R does not use the print() function, but calls a C function named PrintValueEnv, which is not directly available to the user.

  9. 9.

    No further details are needed for now; we shall come back to this very original class of objects.

  10. 10.

    This kind of function is often called a constructor in object-oriented programming.

  11. 11.

    This section does not give details on handling linear models in R; this will be the focus of Chap. 14.

References

  1. Adler J. R in a Nutshell. O’Reilly, 2010.

    Google Scholar 

  2. Akaike H. Information Theory and an Extension of the Maximum Likelihood Principle. In Petrov B. N. and Csaki F., editors, Proc. of the 2nd Int. Symp. on Information Theory, pages 267–81, 1973.

    Google Scholar 

  3. Becker R. A., Chambers J. M. and Wilks A. R. The New S Language: A Programming Environment for Data Analysis and Graphics. Chapman & Hall, 1988.

    Google Scholar 

  4. Belsley D. A., Kuh E. and Welsch R. E. Regression Diagnostics: Identifying Influential Data and Sources of Collinearity. Wiley Series in Probability and Mathematical Statistics. John Wiley & Sons, New York-Chichester-Brisbane, 1980.

    Book  MATH  Google Scholar 

  5. Bilodeau M. and Lafaye de Micheaux P. A-dependence Statistics for Mutual and Serial Independence of Categorical Variables. Journal of Statistical Planning and Inference, 139:2407–19, 2009.

    Google Scholar 

  6. Braun J. W. and Murdoch D. J. A First Course in Statistical Programming with R. Cambridge University Press, 1st edition, January 2008.

    Google Scholar 

  7. Burns P. The R inferno. Unpublished manual, Amazon, 2011.

    Google Scholar 

  8. Chambers J. M. Software for Data Analysis: Programming with R. Statistics and Computing. Springer, June 2008.

    Google Scholar 

  9. Chivers I. and Sleightholme J. Introduction to Programming with Fortran: With Coverage of Fortran 90, 95, 2003, 2008 and 77. Springer, 2nd edition, 2012.

    Google Scholar 

  10. Cohen Y. and Cohen J. Statistics and Data with R: An Applied Approach Through Examples. Wiley, 2008.

    Google Scholar 

  11. Cook R. D. and Weisberg S. Residuals and Influence in Regression. Monographs on Statistics and Applied Probability. Chapman & Hall, London, 1982.

    MATH  Google Scholar 

  12. Crawley M. J. The R Book. Wiley, Chichester, June 2007.

    Google Scholar 

  13. Dalgaard P. Introductory Statistics with R (Statistics and Computing). Springer, 2nd edition, August 2008.

    Google Scholar 

  14. Davison A. C. and Hinkley D. V. Bootstrap Methods and their Applications, volume 1 of Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge University Press, Cambridge, 1997. With 1 IBM-PC floppy disk (3.5 inch; HD).

    Google Scholar 

  15. Everitt B. S. and Hothorn T. A Handbook of Statistical Analyses Using R. Chapman & Hall/CRC, 1st edition, February 2006.

    Google Scholar 

  16. Fisher R. A. Statistical Methods for Research Workers, 4th edition §21.1. Oliver & Boyd, Edinburgh, 1932.

    Google Scholar 

  17. Fox J. Extending the R Commander by “plug in” Packages. R News, 7(3):46–52, 2007.

    Google Scholar 

  18. Furnival G. M. and Jr. Wilson R. W. Regression by Leaps and Bounds. Technometrics, 16:499–511, 1974.

    Google Scholar 

  19. Hand D. J. Branch and Bounds in Statistical Data Analysis. The Statistician, 30:1–13, 1981.

    Article  Google Scholar 

  20. Heiberger R. M. and Neuwirth E. R Through Excel. Use R! Springer, 2009.

    Google Scholar 

  21. Ihaka R. and Gentleman R. R: A Language for Data Analysis and Graphics. Journal of Computational and Graphical Statistics, 5(3):299–314, 1996.

    Google Scholar 

  22. Kernighan B. W. and Ritchie D. M. The C Programming Language, Second Edition. Prentice Hall, 1988.

    Google Scholar 

  23. Lafaye de Micheaux P. and Liquet B. ConvergenceConcepts: An R Package to Investigate Various Modes of Convergence. R Journal, 1(2):18–26, 2009.

    Google Scholar 

  24. Lafaye de Micheaux P. and Liquet B. Understanding Convergence Concepts: A Visual-minded and Graphical Simulation-based Approach. The American Statistician, 63(2):173–8, 2009.

    Google Scholar 

  25. Levene H. Robust Tests for Equality of Variances. In Contributions to probability and statistics, pages 278–92. Stanford Univ. Press, Stanford, Calif., 1960.

    Google Scholar 

  26. Maindonald J. and Braun J. Data Analysis and Graphics Using R: An Example-based Approach (Cambridge Series in Statistical and Probabilistic Mathematics). Cambridge University Press, December 2006.

    Google Scholar 

  27. Mallows C. L. Some Comments on c p . Technometrics, 15:661–75, 1973.

    MATH  Google Scholar 

  28. Matloff N. The Art of R Programming. No Starch Press, 2011.

    Google Scholar 

  29. Meyer C. Matrix Analysis and Applied Linear Algebra. Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 2000. With 1 CD-ROM (Windows, Macintosh and UNIX) and a solutions manual (iv+171 pp.).

    Google Scholar 

  30. Jr. Miller and Rupert G. Simultaneous Statistical Inference. Springer Series in Statistics. Springer-Verlag, New York, 2nd edition, 1981.

    Google Scholar 

  31. Montgomery D. C. Design and Analysis of Experiments. Wiley, 7th edition, 2008.

    Google Scholar 

  32. Muenchen R. A. R for SAS and SPSS Users. Springer Series in Statistics and Computing. Springer, 2009.

    Google Scholar 

  33. Muenchen R. A. and Hilbe J. M. R for Stata Users. Statistics and Computing. Springer, 2010.

    Google Scholar 

  34. Park S. K. and Miller K. W. Random Number Generators: Good Ones are Hard to Find. Commun. ACM, 31(10):1192–1201, 1988.

    Article  MathSciNet  Google Scholar 

  35. Robert C. and Casella G. Introducing Monte Carlo Methods with R (Use R!). Springer, 2009.

    Google Scholar 

  36. Sarkar D. Lattice: Multivariate Data Visualization with R. Use R! Springer, March 2008.

    Google Scholar 

  37. Schwarz G. Estimating the Dimension of a Model. Annals of statistics, 6:461–64, 1978.

    Article  MATH  MathSciNet  Google Scholar 

  38. Stroustrup B. The C++ Programming Language, Third edition. Addison-Wesley, 1997.

    Google Scholar 

  39. Teetor P. R Cookbook. O’Reilly, 2011.

    Google Scholar 

  40. Vinod H. D. Hands-on Intermediate Econometrics Using R: Templates for Extending Dozens of Practical Examples. World Scientific, Hackensack, NJ, 2008.

    Google Scholar 

  41. Weisberg S. Applied Linear Regression, 3rd edition. Wiley-Interscience, 2005.

    Google Scholar 

  42. Zuur A. F., Ieno E. N. and Meesters E. H.W.G. A Beginner’s Guide to R. Springer, 2009.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer Science+Business Media New York

About this chapter

Cite this chapter

de Micheaux, P.L., Drouilhet, R., Liquet, B. (2013). Programming in R . In: The R Software. Statistics and Computing, vol 40. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-9020-3_8

Download citation

Publish with us

Policies and ethics