Lab Instructions

This lab is designed to give you practice acquiring data from an external site and reading it into R. In addition, it should give you more practice using R and Markdown, and provide experience using the R language when producing a

Part 1: Data

  • Find a data set you’re interested in from Seattle’s Open Data Portal at: https://data.seattle.gov/
  • Download that dataset as a CSV file and save it to your computer.
  • Write a code chunk to import the dataset into R using read.csv().
dat<- read.csv("Traffic_Flow_Map_Volumes.csv")

Part 2: Look at the data

Tell me something about the data you downloaded. Why do you think it’s interesting? Since commuting is part of my daily routine. I am interested in where in Seattle has the highest and lowest traffic flow volume in the city.

How large is it, what variables does it contain?

The dataset has 437 rows and 7 columns.

What kind of information is available?

Street Name, Count Location, Year, SEGKEY, Annual Average Weekly Daily Traffic.

What kind of questions might it let you answer?

The locations with the most traffic flow and the locations with least traffic flow.

Use and display a few of the commands we’ve learned (table, head, dim, names) but try to make sure it displays in a readable way. Remember to create separate chunks of code like below and to discuss what you see in the output

table(dat$AAWDT)
## 
##   468   622   800   860   969   971  1079  1298  1379  1400  1447  1506 
##     1     1     1     1     1     1     1     1     1     1     1     2 
##  1602  1611  1615  1657  1666  1753  1767  1842  1918  1929  1941  2155 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  2212  2214  2228  2279  2308  2366  2372  2383  2396  2398  2454  2470 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  2484  2518  2545  2580  2586  2591  2756  2771  2798  2801  2812  2836 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  2841  2941  2951  2952  2963  2981  3047  3090  3095  3171  3183  3205 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  3210  3458  3467  3505  3510  3541  3542  3578  3607  3659  3683  3692 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  3703  3741  3755  3788  3793  3866  3905  3942  3979  4011  4018  4033 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  4041  4080  4099  4108  4125  4137  4159  4170  4187  4206  4247  4251 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  4283  4297  4306  4337  4340  4343  4347  4360  4396  4408  4435  4488 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  4504  4533  4535  4581  4592  4619  4663  4669  4684  4686  4687  4742 
##     1     1     1     1     1     1     2     1     1     1     1     1 
##  4759  4764  4805  4862  4888  4893  4923  4931  4953  5006  5107  5150 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  5153  5288  5375  5377  5440  5447  5532  5537  5547  5559  5566  5576 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  5618  5623  5670  5695  5715  5716  5722  5723  5743  5764  5824  5835 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  5893  5927  5932  5933  5940  5949  5952  6229  6235  6263  6266  6295 
##     1     1     1     1     1     1     1     1     1     2     1     1 
##  6297  6346  6453  6494  6498  6530  6545  6548  6589  6593  6648  6665 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  6667  6703  6736  6763  6777  6804  6815  6827  6832  6873  6904  6932 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  6952  7056  7108  7141  7149  7151  7172  7173  7235  7255  7380  7464 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  7477  7494  7543  7592  7626  7690  7692  7726  7728  7817  7840  7880 
##     1     1     1     1     1     1     1     2     1     1     1     1 
##  7882  7883  7886  7914  7927  7928  7930  7967  7995  8020  8208  8261 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  8382  8471  8502  8618  8645  8695  8696  8706  8749  8763  8767  8834 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  8988  9111  9173  9221  9260  9313  9327  9334  9341  9342  9392  9399 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  9464  9474  9513  9524  9567  9615  9620  9685  9745  9760  9769  9865 
##     1     1     1     1     1     1     1     1     1     1     1     1 
##  9908  9910  9939  9976 10067 10105 10148 10186 10311 10329 10340 10341 
##     1     1     1     2     1     1     1     1     1     1     1     1 
## 10467 10657 10661 10663 10677 10835 10840 10910 11076 11149 11211 11258 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 11275 11330 11393 11430 11485 11646 11890 11923 11927 11929 11974 12021 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 12045 12144 12213 12222 12268 12342 12409 12413 12425 12456 12473 12475 
##     1     1     1     1     2     1     1     1     1     1     1     1 
## 12557 12636 12679 12706 12765 12808 12869 12883 13054 13133 13381 13396 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 13405 13474 13531 13551 13664 13733 13834 13836 13837 13987 14025 14166 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 14244 14341 14401 14404 14450 14513 14631 14897 14970 15006 15036 15115 
##     1     2     1     1     1     1     1     1     1     1     1     1 
## 15203 15261 15287 15469 15473 15793 15903 15978 16056 16105 16118 16123 
##     1     1     1     1     1     1     1     2     1     1     1     1 
## 16217 16523 16571 17559 17728 17733 17748 17759 17806 17839 17916 17985 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 18085 18119 18147 18170 18193 18210 18241 18362 18456 18502 18514 18559 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 18764 18786 18809 18883 19841 20383 20404 20452 20772 20898 21010 21028 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 21094 21115 21312 21422 21597 21978 22578 23009 23053 23168 23819 24341 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 25275 25385 26098 26666 27187 27619 27843 28649 29211 29651 30758 30811 
##     1     1     1     1     1     1     1     1     1     1     1     1 
## 32238 33004 34537 34754 36598 37707 40714 42194 66361 
##     1     1     1     1     1     1     1     1     1
head(dat$COUNT_LOCATION)
## [1] E BOSTON ST, W/O 11TH AVE E          
## [2] E PINE ST, W/O 12TH AVE              
## [3] M L KING JR WAY E, N/O E JOHN ST     
## [4] EASTLAKE AVE E, N/O THOMAS ST        
## [5] SW HENDERSON ST, E/O 11TH AVE SW     
## [6] NE RAVENNA EB BV, E/O BROOKLYN AVE NE
## 437 Levels: 10TH AVE E, S/O E MILLER ST ... YALE AVE, NW/O HOWELL ST
dim(dat)
## [1] 437   7
names(dat)
## [1] "OBJECTID"       "STNAME"         "COUNT_LOCATION" "YEAR"          
## [5] "SEGKEY"         "AAWDT"          "INPUT_STUDY_ID"
summary(dat)
##     OBJECTID                   STNAME   
##  Min.   :  352   3RD AVE          : 11  
##  1st Qu.:12228   1ST AVE          :  9  
##  Median :24033   NE RAVENNA EB BV :  9  
##  Mean   :24570   35TH AVE SW      :  7  
##  3rd Qu.:35702   AIRPORT WAY S    :  7  
##  Max.   :46655   CALIFORNIA AVE SW:  7  
##                  (Other)          :387  
##                      COUNT_LOCATION      YEAR          SEGKEY      
##  10TH AVE E, S/O E MILLER ST:  1    Min.   :2017   Min.   :  1000  
##  11TH AVE NE, N/O NE 45TH ST:  1    1st Qu.:2017   1st Qu.:  7911  
##  11TH AVE NE, N/O NE 52ND ST:  1    Median :2017   Median : 12359  
##  11TH AVE NE, S/O NE 50TH ST:  1    Mean   :2017   Mean   : 20899  
##  11TH AVE W, N/O W DRAVUS ST:  1    3rd Qu.:2018   3rd Qu.: 17899  
##  12TH AVE NE, N/O NE 71ST ST:  1    Max.   :2018   Max.   :652860  
##  (Other)                    :431                                   
##      AAWDT       INPUT_STUDY_ID  
##  Min.   :  468   Min.   :323817  
##  1st Qu.: 4504   1st Qu.:325393  
##  Median : 7840   Median :325779  
##  Mean   : 9923   Mean   :325675  
##  3rd Qu.:13133   3rd Qu.:326138  
##  Max.   :66361   Max.   :327691  
## 

Part 3: Modifying data

If future weeks we’ll learn about modifying data, how to change the orientation of a figure or remove some entries or many other things. Look at your data and think about what would make the raw data more useful. Are dates entered in the wrong form? Do you need locations aggregated to a higher level? Are words entered inconsistently (i.e., Seattle, seattle, SEATTLE)? Start to think forward about what you want to learn to make data as useful as possible for you. If you are experienced with R, go ahead an modify one of the columns.

I would delete the INPUT_STUDY_ID as the dataset already has the objective ID already. I would not include Year as it is either 2017,2018. I would say those are recent and accurate enough. For the first column, I would have OBJECT_ID instead of OBJECTID so it is consistent with others.

Part 4: Final Project

  • Look at the sources of life logging data you have available now. Make a list of the data sources you already have (already are signed up for).

Steps(adminstrative), Sleeping Time(adminstrative), Screen Time(adminstrative).

  • as a second (nested) point on each item, identify whether it is passive, active, or administrative data

  • answer whether you can find a way to download the data you generate. If yes, post a link to where. If no, can you copy the information each day?

https://www.addictivetips.com/windows-tips/how-to-make-sense-of-data-exported-from-the-ios-health-app/

You can export the health data from iphone to computer.

How many do you have, is there any type of data you lack, and is there anything else you’re going to look into acquiring?

I have data for at least 6 months from my phone. I would try to get a heart rate data also and possible dietary application to examine any correlations.

Remember, you’ll want to start data collection next week.