R Markdown

This HTML document is created from associated R Markdown file. It uses following three data sets to perfrom five importing activities. Output of each activity is displayed under respective sections.

  1. Reddit User data
  2. HUD data
  3. Average daily temperature for US cities data

Packages Required

Packages used in assignment to exceute R code are mentioned below:

library(readr)  ##Used to read data from csv file
library(xlsx)  ##Used to read data from xlsx file
library(gdata) ##Used to retreive data from url in excel format
library(XML)  ##Provides the getHTMLLinks() function to identify the links that points to tabular data sets
library(stringr) ##Extract names for desired links and paste to url

Homework 2 problems

  1. Download & import the csv file located at: https://bradleyboehmke.github.io/public/data/reddit.csv
url = "https://bradleyboehmke.github.io/public/data/reddit.csv"
download.file(url,dest="reddit.csv",mode="wb")
reddit_data <- read_csv("reddit.csv") #Reading csv file
## Parsed with column specification:
## cols(
##   id = col_integer(),
##   gender = col_integer(),
##   age.range = col_character(),
##   marital.status = col_character(),
##   employment.status = col_character(),
##   military.service = col_character(),
##   children = col_character(),
##   education = col_character(),
##   country = col_character(),
##   state = col_character(),
##   income.range = col_character(),
##   fav.reddit = col_character(),
##   dog.cat = col_character(),
##   cheese = col_character()
## )
head(reddit_data)
## # A tibble: 6 × 14
##      id gender age.range                           marital.status
##   <int>  <int>     <chr>                                    <chr>
## 1     1      0     25-34                                     <NA>
## 2     2      0     25-34                                     <NA>
## 3     3      1     18-24                                     <NA>
## 4     4      0     25-34                                     <NA>
## 5     5      1     25-34                                     <NA>
## 6     6      0     25-34 Married/civil union/domestic partnership
## # ... with 10 more variables: employment.status <chr>,
## #   military.service <chr>, children <chr>, education <chr>,
## #   country <chr>, state <chr>, income.range <chr>, fav.reddit <chr>,
## #   dog.cat <chr>, cheese <chr>
str(reddit_data)
## Classes 'tbl_df', 'tbl' and 'data.frame':    32754 obs. of  14 variables:
##  $ id               : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ gender           : int  0 0 1 0 1 0 0 0 0 0 ...
##  $ age.range        : chr  "25-34" "25-34" "18-24" "25-34" ...
##  $ marital.status   : chr  NA NA NA NA ...
##  $ employment.status: chr  "Employed full time" "Employed full time" "Freelance" "Freelance" ...
##  $ military.service : chr  NA NA NA NA ...
##  $ children         : chr  "No" "No" "No" "No" ...
##  $ education        : chr  "Bachelor's degree" "Bachelor's degree" "Some college" "Bachelor's degree" ...
##  $ country          : chr  "United States" "United States" "United States" "United States" ...
##  $ state            : chr  "New York" "New York" "Virginia" "New York" ...
##  $ income.range     : chr  "$150,000 or more" "$150,000 or more" "Under $20,000" "$150,000 or more" ...
##  $ fav.reddit       : chr  "getmotivated" "gaming" "snackexchange" "spacedicks" ...
##  $ dog.cat          : chr  NA NA NA NA ...
##  $ cheese           : chr  NA NA NA NA ...
##  - attr(*, "spec")=List of 2
##   ..$ cols   :List of 14
##   .. ..$ id               : list()
##   .. .. ..- attr(*, "class")= chr  "collector_integer" "collector"
##   .. ..$ gender           : list()
##   .. .. ..- attr(*, "class")= chr  "collector_integer" "collector"
##   .. ..$ age.range        : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ marital.status   : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ employment.status: list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ military.service : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ children         : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ education        : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ country          : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ state            : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ income.range     : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ fav.reddit       : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ dog.cat          : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ cheese           : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   ..$ default: list()
##   .. ..- attr(*, "class")= chr  "collector_guess" "collector"
##   ..- attr(*, "class")= chr "col_spec"
  1. Import the above csv file directly from the url provided (without downloading to your local hard drive)
url = "https://bradleyboehmke.github.io/public/data/reddit.csv"
reddit_data_url <- read_csv(url) #Reading csv file
## Parsed with column specification:
## cols(
##   id = col_integer(),
##   gender = col_integer(),
##   age.range = col_character(),
##   marital.status = col_character(),
##   employment.status = col_character(),
##   military.service = col_character(),
##   children = col_character(),
##   education = col_character(),
##   country = col_character(),
##   state = col_character(),
##   income.range = col_character(),
##   fav.reddit = col_character(),
##   dog.cat = col_character(),
##   cheese = col_character()
## )
head(reddit_data_url)
## # A tibble: 6 × 14
##      id gender age.range                           marital.status
##   <int>  <int>     <chr>                                    <chr>
## 1     1      0     25-34                                     <NA>
## 2     2      0     25-34                                     <NA>
## 3     3      1     18-24                                     <NA>
## 4     4      0     25-34                                     <NA>
## 5     5      1     25-34                                     <NA>
## 6     6      0     25-34 Married/civil union/domestic partnership
## # ... with 10 more variables: employment.status <chr>,
## #   military.service <chr>, children <chr>, education <chr>,
## #   country <chr>, state <chr>, income.range <chr>, fav.reddit <chr>,
## #   dog.cat <chr>, cheese <chr>
str(reddit_data_url)
## Classes 'tbl_df', 'tbl' and 'data.frame':    32754 obs. of  14 variables:
##  $ id               : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ gender           : int  0 0 1 0 1 0 0 0 0 0 ...
##  $ age.range        : chr  "25-34" "25-34" "18-24" "25-34" ...
##  $ marital.status   : chr  NA NA NA NA ...
##  $ employment.status: chr  "Employed full time" "Employed full time" "Freelance" "Freelance" ...
##  $ military.service : chr  NA NA NA NA ...
##  $ children         : chr  "No" "No" "No" "No" ...
##  $ education        : chr  "Bachelor's degree" "Bachelor's degree" "Some college" "Bachelor's degree" ...
##  $ country          : chr  "United States" "United States" "United States" "United States" ...
##  $ state            : chr  "New York" "New York" "Virginia" "New York" ...
##  $ income.range     : chr  "$150,000 or more" "$150,000 or more" "Under $20,000" "$150,000 or more" ...
##  $ fav.reddit       : chr  "getmotivated" "gaming" "snackexchange" "spacedicks" ...
##  $ dog.cat          : chr  NA NA NA NA ...
##  $ cheese           : chr  NA NA NA NA ...
##  - attr(*, "spec")=List of 2
##   ..$ cols   :List of 14
##   .. ..$ id               : list()
##   .. .. ..- attr(*, "class")= chr  "collector_integer" "collector"
##   .. ..$ gender           : list()
##   .. .. ..- attr(*, "class")= chr  "collector_integer" "collector"
##   .. ..$ age.range        : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ marital.status   : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ employment.status: list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ military.service : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ children         : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ education        : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ country          : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ state            : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ income.range     : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ fav.reddit       : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ dog.cat          : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   .. ..$ cheese           : list()
##   .. .. ..- attr(*, "class")= chr  "collector_character" "collector"
##   ..$ default: list()
##   .. ..- attr(*, "class")= chr  "collector_guess" "collector"
##   ..- attr(*, "class")= chr "col_spec"
  1. Download & import the csv file located at: http://www.huduser.gov/portal/datasets/fmr/fmr2017/FY2017_4050_FMR.xlsx
url1 <- "http://www.huduser.gov/portal/datasets/fmr/fmr2017/FY2017_4050_FMR.xlsx"
download.file(url1,dest="FY2017_4050_FMR.xlsx",mode="wb")
huduser_data <- read.xlsx("FY2017_4050_FMR.xlsx",sheetIndex = 1) #Reading xlsx file

head(huduser_data)
##     fips2010   fips2000 fmr2 fmr0 fmr1 fmr3 fmr4 State       Metro_code
## 1 2300512300       <NA> 1078  755  851 1454 1579    23 METRO38860MM6400
## 2 6099999999       <NA>  677  502  506  987 1038    60 NCNTY60999N60999
## 3 6999999999       <NA>  666  411  498  961 1158    69 NCNTY69999N69999
## 4 0100199999 0100199999  822  587  682 1054 1425     1 METRO33860M33860
## 5 0100399999 0100399999  977  807  847 1422 1634     1 METRO19300M19300
## 6 0100599999 0100599999  671  501  505  839  958     1 NCNTY01005N01005
##                          areaname county CouSub               countyname
## 1 Portland, ME HUD Metro FMR Area     NA  12300        Cumberland County
## 2                  American Samoa    999  99999           American Samoa
## 3        Northern Mariana Islands    999  99999 Northern Mariana Islands
## 4              Montgomery, AL MSA      1  99999           Autauga County
## 5   Daphne-Fairhope-Foley, AL MSA      3  99999           Baldwin County
## 6              Barbour County, AL      5  99999           Barbour County
##           county_town_name pop2010 acs_2016_2 state_alpha fmr_type metro
## 1    Chebeague Island town     341       1109          ME       40     1
## 2           American Samoa   55519        653          AS       40     0
## 3 Northern Mariana Islands   53883        642          MP       40     0
## 4           Autauga County   54571        788          AL       40     1
## 5           Baldwin County  182265        873          AL       40     1
## 6           Barbour County   27457        636          AL       40     0
##   FMR_PCT_Change FMR_Dollar_Change
## 1      0.9720469               -31
## 2      1.0367534                24
## 3      1.0373832                24
## 4      1.0431472                34
## 5      1.1191294               104
## 6      1.0550314                35
str(huduser_data)
## 'data.frame':    4769 obs. of  21 variables:
##  $ fips2010         : Factor w/ 4769 levels "0100199999","0100399999",..: 1431 4686 4688 1 2 3 4 5 6 7 ...
##  $ fips2000         : Factor w/ 4763 levels "0100199999","0100399999",..: NA NA NA 1 2 3 4 5 6 7 ...
##  $ fmr2             : num  1078 677 666 822 977 ...
##  $ fmr0             : num  755 502 411 587 807 501 665 665 491 464 ...
##  $ fmr1             : num  851 506 498 682 847 505 751 751 494 467 ...
##  $ fmr3             : num  1454 987 961 1054 1422 ...
##  $ fmr4             : num  1579 1038 1158 1425 1634 ...
##  $ State            : num  23 60 69 1 1 1 1 1 1 1 ...
##  $ Metro_code       : Factor w/ 2598 levels "METRO10180M10180",..: 451 2592 2594 384 160 625 55 55 626 627 ...
##  $ areaname         : Factor w/ 2598 levels " Santa Ana-Anaheim-Irvine, CA HUD Metro FMR Area",..: 1903 52 1723 1633 571 122 186 186 263 271 ...
##  $ county           : num  NA 999 999 1 3 5 7 9 11 13 ...
##  $ CouSub           : Factor w/ 1532 levels "00100","00170",..: 234 1532 1532 1532 1532 1532 1532 1532 1532 1532 ...
##  $ countyname       : Factor w/ 1961 levels "Añasco Municipio",..: 462 42 1265 92 99 110 163 178 239 249 ...
##  $ county_town_name : Factor w/ 3175 levels "Añasco Municipio",..: 533 61 2024 136 149 165 254 277 386 401 ...
##  $ pop2010          : num  341 55519 53883 54571 182265 ...
##  $ acs_2016_2       : num  1109 653 642 788 873 ...
##  $ state_alpha      : Factor w/ 56 levels "AK","AL","AR",..: 24 4 28 2 2 2 2 2 2 2 ...
##  $ fmr_type         : num  40 40 40 40 40 40 40 40 40 40 ...
##  $ metro            : num  1 0 0 1 1 0 1 1 0 0 ...
##  $ FMR_PCT_Change   : num  0.972 1.037 1.037 1.043 1.119 ...
##  $ FMR_Dollar_Change: num  -31 24 24 34 104 35 26 26 52 52 ...
  1. Import the above xlsx file directly from the url provided (without downloading to your local hard drive)
url1 <- "http://www.huduser.gov/portal/datasets/fmr/fmr2017/FY2017_4050_FMR.xlsx"
huduser_data_url <- read.xls(url1) #Reading xlsx file

head(huduser_data_url)
##     fips2010  fips2000 fmr2 fmr0 fmr1 fmr3 fmr4 State       Metro_code
## 1 2300512300        NA 1078  755  851 1454 1579    23 METRO38860MM6400
## 2 6099999999        NA  677  502  506  987 1038    60 NCNTY60999N60999
## 3 6999999999        NA  666  411  498  961 1158    69 NCNTY69999N69999
## 4  100199999 100199999  822  587  682 1054 1425     1 METRO33860M33860
## 5  100399999 100399999  977  807  847 1422 1634     1 METRO19300M19300
## 6  100599999 100599999  671  501  505  839  958     1 NCNTY01005N01005
##                          areaname county CouSub               countyname
## 1 Portland, ME HUD Metro FMR Area     NA  12300        Cumberland County
## 2                  American Samoa    999  99999           American Samoa
## 3        Northern Mariana Islands    999  99999 Northern Mariana Islands
## 4              Montgomery, AL MSA      1  99999           Autauga County
## 5   Daphne-Fairhope-Foley, AL MSA      3  99999           Baldwin County
## 6              Barbour County, AL      5  99999           Barbour County
##           county_town_name pop2010 acs_2016_2 state_alpha fmr_type metro
## 1    Chebeague Island town     341       1109          ME       40     1
## 2           American Samoa   55519        653          AS       40     0
## 3 Northern Mariana Islands   53883        642          MP       40     0
## 4           Autauga County   54571        788          AL       40     1
## 5           Baldwin County  182265        873          AL       40     1
## 6           Barbour County   27457        636          AL       40     0
##   FMR_PCT_Change FMR_Dollar_Change
## 1      0.9720469               -31
## 2      1.0367534                24
## 3      1.0373832                24
## 4      1.0431472                34
## 5      1.1191294               104
## 6      1.0550314                35
str(huduser_data_url)
## 'data.frame':    4769 obs. of  21 variables:
##  $ fips2010         : num  2.3e+09 6.1e+09 7.0e+09 1.0e+08 1.0e+08 ...
##  $ fips2000         : num  NA NA NA 1e+08 1e+08 ...
##  $ fmr2             : int  1078 677 666 822 977 671 866 866 621 621 ...
##  $ fmr0             : int  755 502 411 587 807 501 665 665 491 464 ...
##  $ fmr1             : int  851 506 498 682 847 505 751 751 494 467 ...
##  $ fmr3             : int  1454 987 961 1054 1422 839 1163 1163 853 849 ...
##  $ fmr4             : int  1579 1038 1158 1425 1634 958 1298 1298 856 1094 ...
##  $ State            : int  23 60 69 1 1 1 1 1 1 1 ...
##  $ Metro_code       : Factor w/ 2598 levels "METRO10180M10180",..: 451 2592 2594 384 160 625 55 55 626 627 ...
##  $ areaname         : Factor w/ 2598 levels " Santa Ana-Anaheim-Irvine, CA HUD Metro FMR Area",..: 1903 52 1723 1633 571 122 186 186 263 271 ...
##  $ county           : int  NA 999 999 1 3 5 7 9 11 13 ...
##  $ CouSub           : int  12300 99999 99999 99999 99999 99999 99999 99999 99999 99999 ...
##  $ countyname       : Factor w/ 1961 levels "Abbeville County",..: 462 41 1265 92 99 110 163 178 239 249 ...
##  $ county_town_name : Factor w/ 3175 levels "Abbeville County",..: 533 60 2024 136 149 165 254 277 386 401 ...
##  $ pop2010          : int  341 55519 53883 54571 182265 27457 22915 57322 10914 20947 ...
##  $ acs_2016_2       : int  1109 653 642 788 873 636 840 840 569 569 ...
##  $ state_alpha      : Factor w/ 56 levels "AK","AL","AR",..: 24 4 28 2 2 2 2 2 2 2 ...
##  $ fmr_type         : int  40 40 40 40 40 40 40 40 40 40 ...
##  $ metro            : int  1 0 0 1 1 0 1 1 0 0 ...
##  $ FMR_PCT_Change   : num  0.972 1.037 1.037 1.043 1.119 ...
##  $ FMR_Dollar_Change: int  -31 24 24 34 104 35 26 26 52 52 ...

5.Importing the Cincinnati (OHCINCIN.txt) file from webpage http://academic.udayton.edu/kissock/http/Weather/citylistUS.htm

url3 <- "http://academic.udayton.edu/kissock/http/Weather/"

fullUSWebLink <- paste0(url3,"citylistUS.htm")
fullUSWebLink
## [1] "http://academic.udayton.edu/kissock/http/Weather/citylistUS.htm"
#Extracting all weblinks from webpage
allWebPagelinks <- getHTMLLinks(fullUSWebLink) 
allWebPagelinks
##   [1] "gsod95-current/ALBIRMIN.txt"                                   
##   [2] "gsod95-current/ALHUNTSV.txt"                                   
##   [3] "gsod95-current/ALMOBILE.txt"                                   
##   [4] "gsod95-current/ALMONTGO.txt"                                   
##   [5] "gsod95-current/AKANCHOR.txt"                                   
##   [6] "gsod95-current/AKFAIRBA.txt"                                   
##   [7] "gsod95-current/AKJUNEAU.txt"                                   
##   [8] "gsod95-current/AZFLAGST.txt"                                   
##   [9] "gsod95-current/AZPHOENI.txt"                                   
##  [10] "gsod95-current/AZTUCSON.txt"                                   
##  [11] "gsod95-current/AZYUMA.txt"                                     
##  [12] "gsod95-current/ARFTSMIT.txt"                                   
##  [13] "gsod95-current/ARLIROCK.txt"                                   
##  [14] "gsod95-current/CAFRESNO.txt"                                   
##  [15] "gsod95-current/CALOSANG.txt"                                   
##  [16] "gsod95-current/CASACRAM.txt"                                   
##  [17] "gsod95-current/CASANDIE.txt"                                   
##  [18] "gsod95-current/CASANFRA.txt"                                   
##  [19] "gsod95-current/COCOSPGS.txt"                                   
##  [20] "gsod95-current/CODENVER.txt"                                   
##  [21] "gsod95-current/COGRNDJU.txt"                                   
##  [22] "gsod95-current/COPUEBLO.txt"                                   
##  [23] "gsod95-current/CTBRIDGE.txt"                                   
##  [24] "gsod95-current/CTHARTFO.txt"                                   
##  [25] "gsod95-current/DEWILMIN.txt"                                   
##  [26] "gsod95-current/MDWASHDC.txt"                                   
##  [27] "gsod95-current/FLDAYTNA.txt"                                   
##  [28] "gsod95-current/FLJACKSV.txt"                                   
##  [29] "gsod95-current/FLMIAMIB.txt"                                   
##  [30] "gsod95-current/FLORLAND.txt"                                   
##  [31] "http://www.engr.udayton.edu/faculty/jkissock/gsod/FLTALLAH.txt"
##  [32] "gsod95-current/FLTAMPA.txt"                                    
##  [33] "gsod95-current/FLWPALMB.txt"                                   
##  [34] "gsod95-current/GAATLANT.txt"                                   
##  [35] "gsod95-current/GACOLMBS.txt"                                   
##  [36] "gsod95-current/GAMACON.txt"                                    
##  [37] "gsod95-current/GASAVANN.txt"                                   
##  [38] "gsod95-current/HIHONOLU.txt"                                   
##  [39] "gsod95-current/IDBOISE.txt"                                    
##  [40] "gsod95-current/IDPOCATE.txt"                                   
##  [41] "gsod95-current/ILCHICAG.txt"                                   
##  [42] "gsod95-current/ILPEORIA.txt"                                   
##  [43] "gsod95-current/ILROCKFO.txt"                                   
##  [44] "gsod95-current/ILSPRING.txt"                                   
##  [45] "gsod95-current/INEVANSV.txt"                                   
##  [46] "gsod95-current/INFTWAYN.txt"                                   
##  [47] "gsod95-current/ININDIAN.txt"                                   
##  [48] "gsod95-current/INSOBEND.txt"                                   
##  [49] "gsod95-current/IADESMOI.txt"                                   
##  [50] "gsod95-current/IASIOCTY.txt"                                   
##  [51] "gsod95-current/KSGOODLA.txt"                                   
##  [52] "gsod95-current/KSTOPEKA.txt"                                   
##  [53] "gsod95-current/KSWICHIT.txt"                                   
##  [54] "gsod95-current/KYLEXING.txt"                                   
##  [55] "gsod95-current/KYLOUISV.txt"                                   
##  [56] "gsod95-current/KYPADUCA.txt"                                   
##  [57] "gsod95-current/LABATONR.txt"                                   
##  [58] "gsod95-current/LALAKECH.txt"                                   
##  [59] "gsod95-current/LANEWORL.txt"                                   
##  [60] "gsod95-current/LASHREVE.txt"                                   
##  [61] "gsod95-current/MECARIBO.txt"                                   
##  [62] "gsod95-current/MEPORTLA.txt"                                   
##  [63] "gsod95-current/MDBALTIM.txt"                                   
##  [64] "gsod95-current/MDWASHDC.txt"                                   
##  [65] "gsod95-current/MABOSTON.txt"                                   
##  [66] "gsod95-current/MIDETROI.txt"                                   
##  [67] "gsod95-current/MIFLINT.txt"                                    
##  [68] "gsod95-current/MIGRNDRA.txt"                                   
##  [69] "gsod95-current/MILANSIN.txt"                                   
##  [70] "gsod95-current/MISTEMAR.txt"                                   
##  [71] "gsod95-current/MNDULUTH.txt"                                   
##  [72] "gsod95-current/MNMINPLS.txt"                                   
##  [73] "gsod95-current/MSJACKSO.txt"                                   
##  [74] "gsod95-current/MSTUPELO.txt"                                   
##  [75] "gsod95-current/MOKANCTY.txt"                                   
##  [76] "gsod95-current/MOSPRING.txt"                                   
##  [77] "gsod95-current/MOSTLOUI.txt"                                   
##  [78] "gsod95-current/MTBILLIN.txt"                                   
##  [79] "gsod95-current/MTGRFALL.txt"                                   
##  [80] "gsod95-current/MTHELENA.txt"                                   
##  [81] "gsod95-current/NELINCOL.txt"                                   
##  [82] "gsod95-current/NENPLATT.txt"                                   
##  [83] "gsod95-current/NEOMAHA.txt"                                    
##  [84] "gsod95-current/NVRENO.txt"                                     
##  [85] "gsod95-current/NVLASVEG.txt"                                   
##  [86] "gsod95-current/NHCONCOR.txt"                                   
##  [87] "gsod95-current/NJATLCTY.txt"                                   
##  [88] "gsod95-current/NJNEWARK.txt"                                   
##  [89] "gsod95-current/NMALBUQU.txt"                                   
##  [90] "gsod95-current/NYALBANY.txt"                                   
##  [91] "gsod95-current/NYBUFFAL.txt"                                   
##  [92] "gsod95-current/NYNEWYOR.txt"                                   
##  [93] "gsod95-current/NYROCHES.txt"                                   
##  [94] "gsod95-current/NYSYRACU.txt"                                   
##  [95] "gsod95-current/NCASHEVI.txt"                                   
##  [96] "gsod95-current/NCCHARLO.txt"                                   
##  [97] "gsod95-current/NCGRNSBO.txt"                                   
##  [98] "gsod95-current/NCRALEIG.txt"                                   
##  [99] "gsod95-current/NDBISMAR.txt"                                   
## [100] "gsod95-current/NDFARGO.txt"                                    
## [101] "gsod95-current/OHAKRON.txt"                                    
## [102] "gsod95-current/OHCINCIN.txt"                                   
## [103] "gsod95-current/OHCLEVEL.txt"                                   
## [104] "gsod95-current/OHCOLMBS.txt"                                   
## [105] "gsod95-current/OHDAYTON.txt"                                   
## [106] "gsod95-current/OHTOLEDO.txt"                                   
## [107] "gsod95-current/OHYOUNGS.txt"                                   
## [108] "gsod95-current/OKOKLCTY.txt"                                   
## [109] "gsod95-current/OKTULSA.txt"                                    
## [110] "gsod95-current/OREUGENE.txt"                                   
## [111] "gsod95-current/ORMEDFOR.txt"                                   
## [112] "gsod95-current/ORPORTLA.txt"                                   
## [113] "gsod95-current/ORSALEM.txt"                                    
## [114] "gsod95-current/PAALLENT.txt"                                   
## [115] "gsod95-current/PAERIE.txt"                                     
## [116] "gsod95-current/PAHARRIS.txt"                                   
## [117] "gsod95-current/PAPHILAD.txt"                                   
## [118] "gsod95-current/PAPITTSB.txt"                                   
## [119] "gsod95-current/PAWILKES.txt"                                   
## [120] "gsod95-current/RIPROVID.txt"                                   
## [121] "gsod95-current/SCCHARLE.txt"                                   
## [122] "gsod95-current/SCCOLMBA.txt"                                   
## [123] "gsod95-current/SDRAPCTY.txt"                                   
## [124] "gsod95-current/SDRAPCTY.txt"                                   
## [125] "gsod95-current/TNCHATTA.txt"                                   
## [126] "gsod95-current/TNKNOXVI.txt"                                   
## [127] "gsod95-current/TNMEMPHI.txt"                                   
## [128] "gsod95-current/TNNASHVI.txt"                                   
## [129] "gsod95-current/TXABILEN.txt"                                   
## [130] "gsod95-current/TXAMARIL.txt"                                   
## [131] "gsod95-current/TXAUSTIN.txt"                                   
## [132] "gsod95-current/TXBROWNS.txt"                                   
## [133] "gsod95-current/TXCORPUS.txt"                                   
## [134] "gsod95-current/TXDALLAS.txt"                                   
## [135] "gsod95-current/TXELPASO.txt"                                   
## [136] "gsod95-current/TXHOUSTO.txt"                                   
## [137] "gsod95-current/TXLUBBOC.txt"                                   
## [138] "gsod95-current/TXMIDLAN.txt"                                   
## [139] "gsod95-current/TXSANANG.txt"                                   
## [140] "gsod95-current/TXSANANT.txt"                                   
## [141] "gsod95-current/TXWACO.txt"                                     
## [142] "gsod95-current/TXWICHFA.txt"                                   
## [143] "gsod95-current/UTSALTLK.txt"                                   
## [144] "gsod95-current/VTBURLIN.txt"                                   
## [145] "gsod95-current/VANORFOL.txt"                                   
## [146] "gsod95-current/VARICHMO.txt"                                   
## [147] "gsod95-current/VAROANOK.txt"                                   
## [148] "gsod95-current/WASEATTL.txt"                                   
## [149] "gsod95-current/WASPOKAN.txt"                                   
## [150] "gsod95-current/WAYAKIMA.txt"                                   
## [151] "gsod95-current/WVCHARLE.txt"                                   
## [152] "gsod95-current/WVELKINS.txt"                                   
## [153] "gsod95-current/WIGREBAY.txt"                                   
## [154] "gsod95-current/WIMADISO.txt"                                   
## [155] "gsod95-current/WIMILWAU.txt"                                   
## [156] "gsod95-current/WYCASPER.txt"                                   
## [157] "gsod95-current/WYCHEYEN.txt"                                   
## [158] "gsod95-current/PRSANJUA.txt"                                   
## [159] "citylistUS.htm"                                                
## [160] "default.htm"
#Extracting desired weblink using matching expression
links_data <- allWebPagelinks[str_detect(allWebPagelinks,"OHCINCIN.txt")]
links_data
## [1] "gsod95-current/OHCINCIN.txt"
cincinnatiPageLink <- paste0(url3,links_data)
cincinnatiPageLink
## [1] "http://academic.udayton.edu/kissock/http/Weather/gsod95-current/OHCINCIN.txt"
#Saving data from Cincinnati's URL to data set
cincinnati_data <- read.table(cincinnatiPageLink,stringsAsFactors = F,header = T)

head(cincinnati_data)
##   X1 X1.1 X1995 X41.1
## 1  1    2  1995  22.2
## 2  1    3  1995  22.8
## 3  1    4  1995  14.9
## 4  1    5  1995   9.5
## 5  1    6  1995  23.8
## 6  1    7  1995  31.1
str(cincinnati_data)
## 'data.frame':    7962 obs. of  4 variables:
##  $ X1   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ X1.1 : int  2 3 4 5 6 7 8 9 10 11 ...
##  $ X1995: int  1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 ...
##  $ X41.1: num  22.2 22.8 14.9 9.5 23.8 31.1 26.9 31.3 31.5 44.4 ...