DATA101_lab4soln_2022WT1

.pdf

School

University of British Columbia *

*We aren’t endorsed by this school

Course

101

Subject

Electrical Engineering

Date

Apr 3, 2024

Type

pdf

Pages

8

Uploaded by DukeGrouse2352

Report
The University of British Columbia Irving K. Barber Faculty of Science DATA 101 001/002 Lab Questions Practice Solution. In each question below, write out (or type) the required lines of R code, together with the answer to the question. 1. Copy the file income.R to a folder on your computer. This file contains median total family income for a number of Ontario cities by year. 2. Construct the following graph. income <- read.table ( 'income.R' , header = TRUE ) rownames (income) <- income[, 1 ] income <- as.matrix (income[, - 1 ]) dotchart (income, xlab = 'Total median income ($1000s)' , cex = .7 ) mtext ( 'Year' , side = 2 , line = 1.5 , las = 2 , at = 22 ) title ( 'Family Income in Ontario Cities' ) 1
2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 Ottawa Toronto London Windsor Sudbury ThunderBay 65 70 75 80 85 90 Total median income ($1000s) Year Family Income in Ontario Cities 3. Can you make higher lever graph base on what you did for the prviouse question? If so, show your work. colorNO <- as.numeric ( rownames (income)) - 2004 dotchart (income, xlab = 'Total median income ($1000s)' , lcolor =colorNO, color =colorNO, cex = .7 ) mtext ( 'Year' , side = 2 , line = 1.5 , las = 2 , at = 22 , col =colorNO) title ( 'Family Income in Ontario Cities' ) 2
2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 2005 2006 2007 2008 2009 Ottawa Toronto London Windsor Sudbury ThunderBay 65 70 75 80 85 90 Total median income ($1000s) Year Year Year Year Year Family Income in Ontario Cities 4. Copy the file windmill.txt (windmill data) to a folder on your computer. This file contains observations on wind velocity and the corresponding DC electrical output. (a) Construct a graph which effectively displays the information in this data set. windmill <- read.table ( "windmill.txt" , header = TRUE ) plot (windmill, main = "Wind Velocity and DC Electrical Output" ) 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help