Introduction to Statistics (MAT/SST 115.03 2008S)

Additional R notes for Activity 27-3: Televisions and Life Expectancy


We begin by reading in the file.

> TVlife = read.csv("/home/rebelsky/Stats115/Data/TVlife06.csv")

We determine the column names (and, along the way, learn a bit more about each variable).

> summary(TVlife)
      Country   Life.Expectancy   TVs.per.K    
 Angola   : 1   Min.   :38.45   Min.   :  5.0  
 Australia: 1   1st Qu.:59.70   1st Qu.: 87.0  
 Cambodia : 1   Median :70.72   Median :177.0  
 Canada   : 1   Mean   :67.02   Mean   :298.4  
 China    : 1   3rd Qu.:77.16   3rd Qu.:570.2  
 Egypt    : 1   Max.   :81.25   Max.   :844.0  
 (Other)  :16                                  

Remember that the X variable goes first.

> cor(TVlife$TVs.per.K, TVlife$Life.Expectancy)
[1] 0.7432492

Creative Commons License

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-8 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.