Closed jasminacosta closed 6 months ago
Hi, If you want a single year, something like the first code. If you want the five-year, something like the second code using survey. Change year inputs for different years.
get_acs(geography = "tract", variables = "B19013_001", year = 2019)
get_acs(geography = "tract", variables = "B19013_001", year = 2019, survey = "acs5")
On Mon, Oct 30, 2023 at 12:29 PM jasminacosta @.***> wrote:
For lab #5 https://urldefense.com/v3/__https://github.com/Watts-College/cpp-529-spr-2023/issues/5__;!!IKRxdwAv5BmarQ!axLCBzKGTCkp7rSy9nCwcZNVsDcG-CT06Tm67bLWdBIk0PTgAbz72Me_7It22Jx0YqXsUr2drss8-J_oNiXYXKtb-bnZZw$ if we want to have a range of years how do we set those year parameters? Since the acs looks at the year that we select and acs5 looks at the year selected and five years before that. Is there a different name that is used to be able to set our desired year parameters?
Thank you!
— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/Watts-College/cpp-529-spr-2023/issues/19__;!!IKRxdwAv5BmarQ!axLCBzKGTCkp7rSy9nCwcZNVsDcG-CT06Tm67bLWdBIk0PTgAbz72Me_7It22Jx0YqXsUr2drss8-J_oNiXYXKv-RJgRHg$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AMK2Y7YW67LZ4I6P63RMIWLYB75V3AVCNFSM6AAAAAA6WRPJHKVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE3DSMBWHE3TSNI__;!!IKRxdwAv5BmarQ!axLCBzKGTCkp7rSy9nCwcZNVsDcG-CT06Tm67bLWdBIk0PTgAbz72Me_7It22Jx0YqXsUr2drss8-J_oNiXYXKtz8m21tw$ . You are receiving this because you were mentioned.Message ID: @.***>
-- Anthony Howell (Website https://anthonyhowell.netlify.app/) Co-Director, Center for Technology, Data, and Society, Associate Professor, Public Policy Arizona State University
Thank you!
Hi @AntJam-Howell,
For Lab #5 it states to omit cases with growth rates above 200%.
This is the code from the tutorial for that portion of the lab:
mhv.00[ mhv.00 < 1000 ] <- NA
mhv.growth <- 100 * ( mhv.change / mhv.00 )
d$mhv.00 <- mhv.00 d$mhv.10 <- mhv.10 d$mhv.change <- mhv.change d$mhv.growth <- mhv.growth
Do we need to adjust the code or leave it as is? Because then when I did change it to
mhv.growth <- 100 * ( mhv.change / mhv.00 ) mhv.growth[ mhv.growth > 200] <- NA
d$mhv.00 <- mhv.00 d$mhv.10 <- mhv.10 d$mhv.change <- mhv.change d$mhv.growth <- mhv.growth
The summary statistics changed from the instructions that was given.
Thank you!
@jasminacosta Follow the instructions, and change to omitting cases with growth rates above 200%. Not sure why the summary statistics would change, perhaps changes at census, or other factors.
@AntJam-Howell So for the instructions leave everything else the same and just fix the code to omit cases with growth rates above 200%?
Like this?
mhv.growth <- 100 * ( mhv.change / mhv.00 ) mhv.growth[ mhv.growth > 200] <- NA
Becuase this is the summary statistics without adding the change to omitting cases with growth rates above 200%
Then this is the summary statistics with adding those parameters.
Yes
-- Anthony Howell Co-Director, Center for Technology, Data, and Society, Associate Professor, Public Policy Arizona State University
On Sun, Nov 5, 2023 at 8:42 AM jasminacosta @.***> wrote:
@AntJam-Howell https://urldefense.com/v3/__https://github.com/AntJam-Howell__;!!IKRxdwAv5BmarQ!bszoQgCkGPiCih87kvSTrT7AdA4FpB8-5ioBe7idxWf3Q_TbQUtSZvHbNdLK0dpJAXvNXTMsKUPcFvDmAd86ZaoQ9CHxrw$ So for the instructions leave everything else the same and just fix the code to omit cases with growth rates above 200%?
Like this?
mhv.growth <- 100 * ( mhv.change / mhv.00 ) mhv.growth[ mhv.growth > 200] <- NA
Becuase this is the summary statistics without adding the change to omitting cases with growth rates above 200% [image: Screenshot 2023-11-05 at 7 39 59 AM] https://urldefense.com/v3/__https://user-images.githubusercontent.com/136217967/280537681-8368cff2-8cfd-492c-99d2-b7abc981cdda.png__;!!IKRxdwAv5BmarQ!bszoQgCkGPiCih87kvSTrT7AdA4FpB8-5ioBe7idxWf3Q_TbQUtSZvHbNdLK0dpJAXvNXTMsKUPcFvDmAd86Zaqy73mhuw$
Then this is the summary statistics with adding those parameters. [image: Screenshot 2023-11-05 at 7 41 33 AM] https://urldefense.com/v3/__https://user-images.githubusercontent.com/136217967/280537778-ccf94f9c-2155-4459-b068-05c739f5df34.png__;!!IKRxdwAv5BmarQ!bszoQgCkGPiCih87kvSTrT7AdA4FpB8-5ioBe7idxWf3Q_TbQUtSZvHbNdLK0dpJAXvNXTMsKUPcFvDmAd86ZaqXI5kSOQ$
— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/Watts-College/cpp-529-spr-2023/issues/19*issuecomment-1793772065__;Iw!!IKRxdwAv5BmarQ!bszoQgCkGPiCih87kvSTrT7AdA4FpB8-5ioBe7idxWf3Q_TbQUtSZvHbNdLK0dpJAXvNXTMsKUPcFvDmAd86ZaqaOwj4zg$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AMK2Y77LURC4YQSSPNA35MLYC6QWNAVCNFSM6AAAAAA6WRPJHKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTG43TEMBWGU__;!!IKRxdwAv5BmarQ!bszoQgCkGPiCih87kvSTrT7AdA4FpB8-5ioBe7idxWf3Q_TbQUtSZvHbNdLK0dpJAXvNXTMsKUPcFvDmAd86ZaqkNWcfdQ$ . You are receiving this because you were mentioned.Message ID: @.***>
@AntJam-Howell
Great, thank you for the clarification!
@AntJam-Howell
However, now the only issue I find is that the histogram will not plot the "Growth in Home Value by Census Tract 2000 to 2010" when using the code from the instructions?
Hi @AntJam-Howell
I am having a problem with my Dorling Cartogram again since I was not able to download and save it for future use. For this part of lab 4 you helped me to be able to do this part of the code since it was not working on my end:
msp.pop1 <- get_acs( geography = "tract", variables = "B01003_001", state = "27", county = county.fips[state.fips=="27"], geometry = TRUE ) %>% select( GEOID, estimate ) %>% rename( POP=estimate )
Which you helped me by using this code instead:
sdg.pop <- get_acs( geography = "tract", variables = "B01003_001", state = "06", county = county.fips, geometry = TRUE ) %>% select( GEOID, estimate ) %>% rename( POP=estimate ) sdg.pop$GEOID<-sub('.', '', sdg.pop$GEOID)
This did help during my lab 4, but now when I am working on lab 6 that same code to use data from San Diego is not working. I tried the one from the original tutorial and the code you helped me with to solve the issue. However, not even the code you helped me with is working and it keeps stating:
Error in rename(., POP = estimate) : unused argument (POP = estimate)
I do not understand why this is happening and I have tried different variations of the code to hopefully make it work, but to no avail.
@AntJam-Howell
@jasminacosta what code did you supply to create the histogram that leads to missing information? the below should work:
mhv.00[ mhv.00 < 1000 ] <- NA
# change in MHV in percent
mhv.growth <- 100 * ( mhv.change / mhv.00 )
# Omit cases with growth rates above 200%
mhv.growth[ mhv.growth > 200 ] <- NA
d$mhv.00 <- mhv.00
d$mhv.10 <- mhv.10
d$mhv.change <- mhv.change
d$mhv.growth <- mhv.growth
# average growth in median home value for the city
d <-
d %>%
group_by( cbsaname ) %>%
mutate( metro.mhv.change = median( mhv.change, na.rm=T ),
metro.mhv.growth = 100 * median( mhv.growth, na.rm=T ) ) %>%
ungroup()
@jasminacosta i will email you about lab 4
@AntJam-Howell
Okay, thank you!
@AntJam-Howell
The code that I had used was:
hg <- hist( mhv.growth, breaks=5000, xlim=c(-100,200), yaxt="n", xaxt="n", xlab="", cex.main=1.5, ylab="", main="Growth in Home Value by Census Tract 2000 to 2010", col="gray40", border="white" )
axis( side=1, at=seq( from=-100, to=200, by=50 ), labels=paste0( seq( from=-100, to=200, by=50 ), "%" ) )
ymax <- max( hg$count )
mean.x <- mean( mhv.growth, na.rm=T ) abline( v=mean.x, col="darkorange", lwd=2, lty=2 ) text( x=100, y=(0.5*ymax), labels=paste0( "Mean = ", round(mean.x,0), "%"), col="darkorange", cex=1.8, pos=4 )
median.x <- median( mhv.growth, na.rm=T ) abline( v=median.x, col="dodgerblue", lwd=2, lty=2 ) text( x=100, y=(0.6*ymax), labels=paste0( "Median = ", round(median.x,0), "%"), col="dodgerblue", cex=1.8, pos=4 )
which was in the instructions but I have no idea why it was not showing properly.
@AntJam-Howell
The code that I had used was:
hg <- hist( mhv.growth, breaks=5000,
@jasminacosta
I've found that if you change the number of breaks from 5000 to 100 it displays the histogram properly.
Respectfully, John Spaeth
@AntJam-Howell The code that I had used was: hg <- hist( mhv.growth, breaks=5000,
@jasminacosta
I've found that if you change the number of breaks from 5000 to 100 it displays the histogram properly.
Respectfully, John Spaeth
@JJSpaeth
Hi, that helped me fix the issue! Thank you so much!
Thank you again, Jasmin Acosta
Hi @AntJam-Howell
For lab #5 if we want to have a range of years how do we set those year parameters? Since the acs looks at the year that we select and acs5 looks at the year selected and five years before that. Is there a different name that is used to be able to set our desired year parameters?
Thank you!