123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- library(ggplot2)
- I = c(0,0,0,0,.005,0,.002,.01,.012,.01,.012,.0,.022,.020,.017,.03,.015,.052,.072,.06,.062,.062,.052,.047,.065,.09,.082,.077,.037,.017,.067)
- data = data.frame(I,II,III,IV,V,VI,VII)
- ggplot(data) + geom_point()
- ggplot(data[I]) + geom_point()
- ggplot(data[I],aes(x,y)) + geom_point()
- data
- mtcars
- data = rbind(I,II,III,IV,V,VI,VII)
- data
- ggplot(data,aes(x="I",y="[],1]")) + geom_point()
- plot(data)
- par(mfrow=c(3,3))
- "indigo"
- par(mfrow=c(1,1))
- plot(I, color="red",pch=21,xlab = "bins",ylab="frequency")
- plot(I, gcolor="red",pch=21,xlab = "bins",ylab="frequency")
- plot(I, gcolor="red",pch=21,xlab = "bins",ylab="frequency")
- plot(II, gcolor="orange",pch=21,xlab="bins",ylab="frequency")
- plot(III, gcolor="yellow",pch=21,xlab="bins",ylab="frequency")
- plot(IV, gcolor="green",pch=21,xlab="bins",ylab="frequency")
- plot(V, gcolor="blue",pch=21,xlab="bins",ylab="frequency")
- plot(VI, gcolor="indigo",pch=21,xlab="bins",ylab="frequency")
- plot(VII, gcolor="purple",pch=21,xlab="bins",ylab="frequency")
- plot(VII, gcolor="purple",pch=16,xlab="bins",ylab="frequency")
- plot(I, col="red",pch=16,xlab = "bins",ylab="frequency")
- par(bg="pink")
- plot(I, col="red",pch=16,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=16)
- plot(I, col="red",pch=16,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=16)
- points(III, col="yellow",pch=16)
- points(IV, col="green",pch=16)
- points(V, col="blue",pch=16)
- points(VI, col="indigo",pch=16)
- plot(I, col="red",pch=8,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=8)
- points(III, col="yellow",pch=8)
- points(IV, col="green",pch=8)
- points(V, col="blue",pch=8)
- points(VI, col="indigo",pch=8)
- points(VII, col="purple",pch=8)
- plot(I, col="red",pch=8,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=8)
- points(III, col="yellow",pch=8)
- points(IV, col="green",pch=8)
- points(V, col="blue",pch=8)
- points(VI, col="indigo",pch=8)
- legend(0,0,legend=c("I","II","III","IV","V","VI","VII")
- )
- legend(0,0,legend=c("I","II","III","IV","V","VI","VII"))
- legend(1,1,legend=c("I","II","III","IV","V","VI","VII"))
- plot(I, col="red",pch=8,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=8)
- points(III, col="yellow",pch=8)
- points(IV, col="green",pch=8)
- points(V, col="blue",pch=8)
- points(VI, col="purple",pch=8)
- points(VII, col="black",pch=8)
- legend(1,1,legend=c("I","II","III","IV","V","VI","VII"))
- legend(0,1,legend=c("I","II","III","IV","V","VI","VII"))
- legend(1,95,legend=c("I","II","III","IV","V","VI","VII"))
- legend(1,1,legend=c("I","II","III","IV","V","VI","VII"))
- legend(1,1,legend=c("I","II","III","IV","V","VI","VII"),fill="white")
- legend(1,1,legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- legend(legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- legend(0,legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- legend(3,legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- legend(x=0,y=1legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- legend(x=0,y=1,legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- par(bg="pink")
- plot(I, col="red",pch=8,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=8)
- points(III, col="yellow",pch=8)
- points(IV, col="green",pch=8)
- points(V, col="blue",pch=8)
- points(VI, col="purple",pch=8)
- points(VII, col="black",pch=8)
- legend(x=0,y=1,legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),fill="white",col=c("red","orange","yellow","green","blue","purple","black"))
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),col=c("red","orange","yellow","green","blue","purple","black"))
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),col=1:7)
- plot(I, col="red",pch=8,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=8)
- points(III, col="yellow",pch=8)
- points(IV, col="green",pch=8)
- points(V, col="blue",pch=8)
- points(VI, col="purple",pch=8)
- points(VII, col="black",pch=8)
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),col=1:7)
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),col=c("red","orange","yellow","green","blue","purple","black"))
- plot(I, col="red",pch=8,xlab = "bins",ylab="frequency")
- points(II, col="orange",pch=8)
- points(III, col="yellow",pch=8)
- points(IV, col="green",pch=8)
- points(V, col="blue",pch=8)
- points(VI, col="purple",pch=8)
- points(VII, col="black",pch=8)
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),col=c("red","orange","yellow","green","blue","purple","black"))
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),col=c("red","orange","yellow","green","blue","purple","black"))
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),fill=c("red","orange","yellow","green","blue","purple","black"))
- plot(I, col="red",pch=8,xlab = "Bins",ylab="Frequency")
- points(II, col="orange",pch=8)
- points(III, col="yellow",pch=8)
- points(IV, col="green",pch=8)
- points(V, col="blue",pch=8)
- points(VI, col="purple",pch=8)
- points(VII, col="black",pch=8)
- legend("topleft",legend=c("I","II","III","IV","V","VI","VII"),fill=c("red","orange","yellow","green","blue","purple","black"))
- bins = rep(c(1:31),each=7)
- bins
- 1:31
- bins = rep(c((1:31)),each=7)
- 1:31
- bins
- bins = rep(c((1:31)),times=7)
- bins
- sample = rep(c("I","II","III","IV","V","VI","VII"), each =31)
- sample
- library(tidyverse)
- I = c(0,0,0,0,.005,0,.002,.01,.012,.01,.012,.0,.022,.020,.017,.03,.015,.052,.072,.06,.062,.062,.052,.047,.065,.09,.082,.077,.037,.017,.067)
- II = c(0,0,.002,0,0,.004,.004,.011,.009,.015,.013,.017,.028,.028,.019,.026,.030,.043,.054,.054,.058,.078,.061,.061,.056,.082,.069,.078,.032,.030,.035)
- III = c(0,0,0,0,0,0,.012,.006,.014,.006,.017,.012,.038,.012,.003,.029,.049,.043,.078,.058,.064,.066,.052,.072,.069,.061,.081,.075,.026,.006,.052)
- IV = c(0,0,0,0,0,.003,.006,.009,.006,.009,.012,.006,.037,.018,.027,.040,.015,.046,.095,.073,.067,.064,.052,.043,.052,.061,.073,.076,.015,.027,.067)
- V = c(0,0,0,0,0,.010,.012,.012,.007,.022,.026,.014,.034,.026,.031,.022,.034,.043,.048,.058,.077,.046,.050,.050,.072,.063,.050,.072,.019,.026,.075)
- install.packages("assertthat")
- library(tidyverse)
- install.packages("Rcpp")
- library(tidyverse)
- I = c(0,0,0,0,.005,0,.002,.01,.012,.01,.012,.0,.022,.020,.017,.03,.015,.052,.072,.06,.062,.062,.052,.047,.065,.09,.082,.077,.037,.017,.067)
- II = c(0,0,.002,0,0,.004,.004,.011,.009,.015,.013,.017,.028,.028,.019,.026,.030,.043,.054,.054,.058,.078,.061,.061,.056,.082,.069,.078,.032,.030,.035)
- III = c(0,0,0,0,0,0,.012,.006,.014,.006,.017,.012,.038,.012,.003,.029,.049,.043,.078,.058,.064,.066,.052,.072,.069,.061,.081,.075,.026,.006,.052)
- IV = c(0,0,0,0,0,.003,.006,.009,.006,.009,.012,.006,.037,.018,.027,.040,.015,.046,.095,.073,.067,.064,.052,.043,.052,.061,.073,.076,.015,.027,.067)
- V = c(0,0,0,0,0,.010,.012,.012,.007,.022,.026,.014,.034,.026,.031,.022,.034,.043,.048,.058,.077,.046,.050,.050,.072,.063,.050,.072,.019,.026,.075)
- VI = c(0,0,0,.002,0,.007,.005,.009,.009,.011,.014,.018,.043,.016,.027,.018,.043,.080,.062,.050,.084,.082,.062,.071,.050,.082,.057,.043,.005,.014,.034)
- VII = c(0,.002,.002,.003,.002,.003,.013,.013,.018,.015,.020,.016,.031,.010,.042,.016,.021,.028,.056,.056,.090,.044,.044,.056,.065,.075,.083,.075,.025,.026,.051)
- bins = rep(c((1:31)),times=7)
- sample = rep(c("I","II","III","IV","V","VI","VII"), each =31)
- values = c(I,II,III,IV,V,VI,VII)
- length(values)
- length(bins)
- length(sample)
- data = data.frame(bins,sample,values)
- data
- ggplot(data) +
- geom_point(mapping=aes(x=bins,y=values,color=sample)) +
- theme_bw()
- ggplot(data) +
- geom_point(mapping=aes(x=bins,y=values,color=sample)) +
- theme_bw() + xlab("Bin") + ylab("Alelles") +
- scale_x_continuous(breaks=(1:31))
- library(tidyverse)
- ggplot(data) +
- geom_point(mapping=aes(x=bins,y=values,color=sample)) +
- theme_bw() + xlab("Bin") + ylab("Alelle Frecuency") +
- scale_x_continuous(breaks=(1:31))
- a = c(9.96,9.97,9.95)
- sd(a)
- b = sd(a)
- b
- help(sd)
- a = c(10.01,10.26,9.96)
- sd(a)
- a = c(9.63,9.74,9.76)
- sd(a)
- a = c(7.24,7.59,8.46)
- sd(a)
- a = c(1.027,1.029,1.026)
- sd(a)
- mean(a)
- 2,5/10.27
- 2.5/10.27
- 10.25/10
- density = c(0.99,1.006,1.027,1.045,1.067)
- concentration = (0.87,2.01,5.02,7.00,10.00)
- concentration = c(0.87,2.01,5.02,7.00,10.00)
- plot(density, concentration)
- library(tidyverse)
- I = c(0,0,0,0,.005,0,.002,.01,.012,.01,.012,.0,.022,.020,.017,.03,.015,.052,.072,.06,.062,.062,.052,.047,.065,.09,.082,.077,.037,.017,.067)
- II = c(0,0,.002,0,0,.004,.004,.011,.009,.015,.013,.017,.028,.028,.019,.026,.030,.043,.054,.054,.058,.078,.061,.061,.056,.082,.069,.078,.032,.030,.035)
- III = c(0,0,0,0,0,0,.012,.006,.014,.006,.017,.012,.038,.012,.003,.029,.049,.043,.078,.058,.064,.066,.052,.072,.069,.061,.081,.075,.026,.006,.052)
- IV = c(0,0,0,0,0,.003,.006,.009,.006,.009,.012,.006,.037,.018,.027,.040,.015,.046,.095,.073,.067,.064,.052,.043,.052,.061,.073,.076,.015,.027,.067)
- V = c(0,0,0,0,0,.010,.012,.012,.007,.022,.026,.014,.034,.026,.031,.022,.034,.043,.048,.058,.077,.046,.050,.050,.072,.063,.050,.072,.019,.026,.075)
- VI = c(0,0,0,.002,0,.007,.005,.009,.009,.011,.014,.018,.043,.016,.027,.018,.043,.080,.062,.050,.084,.082,.062,.071,.050,.082,.057,.043,.005,.014,.034)
- VII = c(0,.002,.002,.003,.002,.003,.013,.013,.018,.015,.020,.016,.031,.010,.042,.016,.021,.028,.056,.056,.090,.044,.044,.056,.065,.075,.083,.075,.025,.026,.051)
- bins = rep(c((1:31)),times=7)
- sample = rep(c("I","II","III","IV","V","VI","VII"), each =31)
- values = c(I,II,III,IV,V,VI,VII)
- data = data.frame(bins,sample,values)
- ggplot(data) +
- geom_point(mapping=aes(x=bins,y=values,color=sample)) +
- theme_bw() + xlab("Bin") + ylab("Alelle Frecuency") +
- scale_x_continuous(breaks=(1:31))
- library(tidyverse)
- density = c(0.99,1.006,1.027,1.045,1.067)
- concentration = c(0.87,2.01,5.02,7.00,10.00)
- data = data.frame(density,concentration)
- data
- ggplot(data) +
- geom_point(mapping=aes(x=density,y=concentration,color=sample)) +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%")
- ggplot(data) +
- geom_point(mapping=aes(x=density,y=concentration)) +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%")
- ggplot(data) +
- geom_point(mapping=aes(x=density,y=concentration)) +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%")+
- geom_smooth(method='lm')
- ggplot(data) +
- geom_point(mapping=aes(x=density,y=concentration)) +
- geom_smooth(method='lm') +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%")
- ggplot(data, aes(x=density,y=concentration)) +
- geom_point() +
- geom_smooth(method='lm') +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%")
- ggplot(data, aes(x=density,y=concentration)) +
- geom_point() +
- geom_smooth(method='lm') +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%") +
- ggtitle("Density vs Concentration of Prepared Solutions")
- data = data.frame(density,concentration)
- model <- lm(concentration~density, data=data)
- summary(model)
- ggplot(data, aes(x=density,y=concentration)) +
- geom_point() +
- geom_smooth(method='lm') +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%") +
- ggtitle("Density vs Concentration of Prepared Solutions") +
- geom_label(x = x_lab, y = y_lab, label = "avg rate")
- ggplot(data, aes(x=density,y=concentration)) +
- geom_point() +
- geom_smooth(method='lm') +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%") +
- ggtitle("Density vs Concentration of Prepared Solutions") +
- geom_label(x = 1, y = 5, label = "avg rate")
- summary(model)
- ggplot(data, aes(x=density,y=concentration)) +
- geom_point() +
- geom_smooth(method='lm') +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%") +
- ggtitle("Density vs Concentration of Prepared Solutions") +
- geom_label(x = 1, y = 5, label = "y = 120.94x - 119.23") +
- geom_label(x = 1, y = 4, label = "R-squared: 0.9931") +
- xx
- library(tidyverse)
- density = c(0.99,1.006,1.027,1.045,1.067)
- concentration = c(0.87,2.01,5.02,7.00,10.00)
- data = data.frame(density,concentration)
- model <- lm(concentration~density, data=data)
- summary(model)
- ggplot(data, aes(x=density,y=concentration)) +
- geom_point() +
- geom_smooth(method='lm') +
- theme_bw() + xlab("Density(g/mL)") + ylab("Concentration%") +
- ggtitle("Density vs Concentration of Prepared Solutions") +
- geom_label(x = 1, y = 5, label = "y = 120.94x - 119.23") +
- geom_label(x = 1, y = 4, label = "R-squared: 0.9931")
- p = c(5.10,5.25,5.16)
- v = c(4.86,5.01,4.94)
- mean(p)
- sd(p)
- mean(v)
- sd(v)
- A = c(0.335,0.199,0.0953,0.0278)
- concentration = c(0.60,0.30,0.12,0.06)
- data = data.frame(A,concentration)
- model <- lm(A~concentration, data=data)
- summary(model)
- data = data.frame(A,concentration)
- model <- lm((A-0.01674)~(concentration-0.01674), data=data)
- summary(model)
- data = data.frame(A,concentration)
- model <- lm((A-0.01674)~(concentration-0.01674), data=data)
- summary(model)
- data = data.frame(A,concentration)
- model <- lm(I(A-0.01674)~(concentration-0.01674), data=data)
- summary(model)
- c = c(5.10,5.26,5.17)
- sd(c)
- mean(c)
- library(tidycensus)
- library(tidyverse)
- install.package("tidycensus")
- install.packages("tidycensus")
- library(tidyverse)
- library(tidycensus)
- library(tidycensus)
- library(tidyverse)
- library("writexl")
- census_api_key("7a853acf81fd5758228680556ac831138c40b83e")
- variables = load_variables(2019,"acs5")
- variables
- variables$name
- match("DP02",variables)
- variables$name[2000]
- variables$name[3000]
- variables$name[5000]
- variables$name[10000]
- variables$name[600000]
- variables$name[60000]
- variables$name[50000]
- variables$name[40000]
- variables$name[30000]
- variables$name[20000]
- variables = load_variables(2019,"acs5/profile")
- variables
- View(variables)
- length(variables)
- length(variables[1])
- variables = load_variables(2021,"acs5/profile")
- variables = load_variables(2020,"pl/profile")
- variables = load_variables(2020,"acs5/profile")
- variables
- View(variables)
- test = get_acs(geography = "county",
- state = "PR",
- year = 2020,
- variables = "DP02_0001")
- test
- View(test)
- test = get_acs(geography = "region",
- state = "PR",
- year = 2020,
- variables = "DP02_0001")
- test = get_acs(geography = "block",
- state = "PR",
- year = 2020,
- variables = "DP02_0001")
- test = get_acs(geography = "county",
- state = "PR",
- year = 2020,
- variables = "DP02_0001")
- View(test)
- variables$name
- codes = variables$name
- test = get_acs(geography = "county",
- state = "PR",
- year = 2020,
- variables = codes)
- view(test)
- noNA = na.omit(test)
- noNA
- view(noNA)
- view(variables)
- DP02table = noNA %>% filter(startsWith(variable,"DP02"))
- DP02table
- view(DP02table)
- DP02table = noNA %>% filter(startsWith(variable,"DP02"))
- DP03table = noNA %>% filter(startsWith(variable,"DP03"))
- DP04table = noNA %>% filter(startsWith(variable,"DP04"))
- DP05table = noNA %>% filter(startsWith(variable,"DP05"))
- view(DP04table)
- variables$name
- variables$label
- noNA$GEOID
- table(noNA$GEOID)
- length(table(noNA$GEOID))
- view(test)
- #amount of GEOIDS
- for (x in 1:78){
- labelCol = c(labelCol, labels)
- }
- #add label column
- #create empty vector
- labelCol = c()
- #amount of GEOIDS
- for (x in 1:78){
- labelCol = c(labelCol, labels)
- }
- #combine test and cols
- test["label"] = labelCol
- labelCol
- #amount of GEOIDS
- for (x in 1:78){
- labelCol = c(labelCol, labels)
- }
- labels()
- labels()
- labels
- variables
- variables$label
- label
- labels
- label0 = variables$label
- label0
- #add label column
- #create empty vector
- labelCol = c()
- #amount of GEOIDS
- for (x in 1:78){
- labelCol = c(labelCol, label0)
- }
- #combine test and cols
- test["label"] = labelCol
- view(test)
- #omit NA rows
- noNA = na.omit(test)
- DP02table = noNA %>% filter(startsWith(variable,"DP02"))
- DP03table = noNA %>% filter(startsWith(variable,"DP03"))
- DP04table = noNA %>% filter(startsWith(variable,"DP04"))
- DP05table = noNA %>% filter(startsWith(variable,"DP05"))
- view(DP02table)
- GEOIDS = table(test$GEOID)
- GEOIDS
- #rearrange cols
- test = test[c("NAME","label","variable","estimate","moe","GEOID")]
- view(test)
- pnorm(1.25)
- pnorm(1.25) - pnorm(-1.25)
- pnorm(1.875) - pnorm(-1.25)
- pnorm(0.75) - pnorm(-1.25)
- pnorm(1.25) - pnorm(-2.5)
- pnorm(2.7) - pnorm(2)
- pnorm(1.54)
- pnorm(1.54) - pnorm(-1.54)
- qnorm(0.4564)
- qnorm(0.9564)
- qnorm(0.05)
- qnorm(0.07)
- qnorm(0.94)
- qnorm(0.43)
- pnorm(-0.18)
- qnorm(0.43)
- pnorm(-0.17)
- pnorm(-1.30)
- qnorm(0.70,400,80)
- (106 - qnorm(0.70,106,21))/21
- (qnorm(0.70,106,21)-106)/21
- (qnorm(0.87,106,28)
- )
- qnorm(0.77)
- 0.74 * 17 + 108
- pnorm(252,369,59)
- pnorm(140,120,18) - pnorm(110,120,18)
- qnorm(0.87,100,10)
- 1- pnorm(96,100,20)
- pnorm(180,159,10) - pnorm(150,159,10)
- (pnorm(180,159,10) - pnorm(150,159,10))*425
- x = c(-40,0,260,460,960)
- px = c(0.99510,1/200,1/500,1/1000,1/2000)
- len(px)
- length(px)
- Ex = sum(x*px)
- Vx = sum(((x-Ex)^2)*px)
- Ex
- Vx
- library(tidycensus)
- library(tidyverse)
- tableYear = 2020
- #log on with API
- census_api_key("7a853acf81fd5758228680556ac831138c40b83e")
- #load variables
- pueblos = 78
- variables = load_variables(2020,"acs5/profile")
- codes = variables$name
- codess
- codes
- startsWith(codes,"DP02")
- callData = function(year,table,municipality) {
- #year is between 2000 and 2020
- #table is dp02pr, dp03, dp04, dp05
- #load variables
- variables = load_variables(year,"acs5/profile")
- #load variable vectors
- codes = variables$name
- codesBool = startsWith(codes,table)
- codes = codes[codesBool]
- labels = variables$label[codesBool]
- #pull table
- bigTable = get_acs(geography = "county",
- state = "PR",
- year = year,
- county = municipality,
- variables = codes)
- bigTable$Label = labels
- return(bigTable)
- }
- table = callData(2020,"DP05","Aguada")
- table
- view(table)
- view(table)
- callData = function(year,table,municipality) {
- #year is between 2000 and 2020
- #table is dp02pr, dp03, dp04, dp05
- #load variables
- variables = load_variables(year,"acs5/profile")
- #load variable vectors
- codes = variables$name
- codesBool = startsWith(codes,table)
- codes = codes[codesBool]
- labels = variables$label[codesBool]
- #pull table
- bigTable = get_acs(geography = "county",
- state = "PR",
- year = year,
- county = municipality,
- variables = codes)
- bigTable$Label = labels
- bigTable = bigTable[c("Label","estimate","moe")]
- return(bigTable)
- }
- table = callData(2020,"DP05","Aguada")
- view(table)
- plumber::plumb(file='C:/Users/kashi/Desktop/R.R')$run()
- plumb(file='C:/Users/kashi/Desktop/R.R')$run()
- setwd("C:/Users/kashi/Desktop")
- plumb(file='R.R')$run()
- setwd("C:/Users/kashi/Desktop/censusproject")
- plumb(file='R.R')$run()
- plumb(file='R.R')$run()
- plumb(file='R.R')$run()
|