8: Appendix A- Example of R session
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