Skip to main content
Statistics LibreTexts

8: Appendix A- Example of R session

  • Page ID
    3602
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The following is for impatient readers who prefer to learn R in a speedy way. They will need to type all commands listed below. Please do not copy-paste them but exactly type from the keyboard: that way, they will be much easier to remember and consequently to learn. For each command, we recommend to read the help (call it with ?command). As an exception from most others parts of this book, R output and plots are generally not shown below. You will need to check and get them yourself. We strongly recommend also to “play” with commands: modify them and look how they work.

    All of the following relates with an imaginary data file containing information about some insects. Data file is a table of four columns separated with tabs:

    SEX COLOR WEIGHT LENGTH
    0 1 10.68 9.43
    1 1 10.02 10.66
    0 2 10.18 10.41
    1 1 8.01 9
    0 3 10.23 8.98
    1 3 9.7 9.71
    1 2 9.73 9.09
    0 3 11.22 9.23
    1 1 9.19 8.97
    1 2 11.45 10.34

    Companion file bugs_c.txt contains information about these characters:

    # Imaginary insects
    SEX females 0, males 1
    COLOR red 1, blue 2, green 3
    LENGTH length of the insect in millimeters


    This page titled 8: Appendix A- Example of R session is shared under a Public Domain license and was authored, remixed, and/or curated by Alexey Shipunov via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.