Working on 1990's
This commit is contained in:
parent
b5e715400e
commit
5c1ad7185f
BIN
Data/Pop_1990s.xls
Normal file
BIN
Data/Pop_1990s.xls
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
library(rvest)
|
library(rvest)
|
||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
|
library(readxl)
|
||||||
|
|
||||||
########County, Death, Birth and Migration Data
|
########County, Death, Birth and Migration Data
|
||||||
#Data found on the page http://eadiv.state.wy.us/pop/
|
#Data found on the page http://eadiv.state.wy.us/pop/
|
||||||
@ -110,21 +110,14 @@ CITY_POP <- rbind(CITY_TBL,CITY_POP)
|
|||||||
CITY_POP$City <- gsub("LaGrange","La_Grange",CITY_POP$City)
|
CITY_POP$City <- gsub("LaGrange","La_Grange",CITY_POP$City)
|
||||||
COUNTY_POP <- rbind(COUNTY_TBL,COUNTY_POP)
|
COUNTY_POP <- rbind(COUNTY_TBL,COUNTY_POP)
|
||||||
####################County and City Population DAta for 1990-2000
|
####################County and City Population DAta for 1990-2000
|
||||||
PAGE <- read_html('http://eadiv.state.wy.us/pop/c&sc90_00.htm')
|
if(!file.exists("./Data/Pop_1990s.xls")){download.file('http://eadiv.state.wy.us/pop/c&sc90_00.xls',"./Data/Pop_1990s.xls")}
|
||||||
NODE <- html_element(PAGE ,"body")
|
TEMP <- read_xls("Data/Pop_1990s.xls",skip=2)[-1:-4,]
|
||||||
TEST <- read_table(html_text2(NODE),skip=21,skip_empty_rows=TRUE)
|
colnames(TEMP)[1] <- "County"
|
||||||
TO_ADJ <- sum((!is.na(TEST[2,])))-11
|
tail(TEMP)
|
||||||
|
TEMP <- TEMP[1:which(TEMP[,1]=="Wind River Res."),]
|
||||||
?read_table
|
|
||||||
?html_text2
|
|
||||||
?html_text
|
|
||||||
TBL <- html_table(NODE)
|
|
||||||
TBL
|
|
||||||
|
|
||||||
ST <- which(toupper(TBL$X1)==toupper("Albany Cnty"))
|
|
||||||
END <- which(toupper(TBL$X1)==toupper("Balance of Weston County"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TEMP <- pivot_longer(TEMP,all_of(colnames(TEMP)[-1]),names_to="Year",values_to="Population") %>% mutate(Year=as.integer(Year),Population=as.numeric(Population))
|
||||||
|
TEMP_COUNTY <- TEMP[grepl("Cnty",TEMP %>% pull(County),ignore.case=TRUE),]
|
||||||
|
TEMP_CITY <- TEMP[grep("Cnty",TEMP %>% pull(County),ignore.case=TRUE,invert=TRUE),]
|
||||||
|
TEMP_CITY
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user