<html><head></head><body>Ps, can you also confirm that you've reinstalled your api key?<br><br><div class="gmail_quote">On July 13, 2017 12:43:52 PM EDT, Ezra Haber Glenn <eglenn@mit.edu> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br />There have been some issues with the online variable lookup tables<br />that the package needs to access. Can you try this function (just<br />once -- no need to use it every time) :<br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> acs.tables.install()<br /></blockquote><br />after that, see if your script works.<br /><br />Thanks.<br /><br />--Ezra<br /><br /><br />On Thu, 13 Jul 2017 12:33:39 -0400, Sara Hintze wrote:<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> <br /> [1 <multipart/alternative (7bit)>]<br /> [1.1 <text/plain; us-ascii (quoted-printable)>]<br /> [1.2 <text/html; us-ascii (quoted-printable)>]<br /> Hi all,<br /> <br /> I recently upgraded from acs 2.0 to 2.1 and am receiving errors from a script that<br /> previously worked under acs 2.0. I’ve attached the original script along with the console<br /> output. Have I missed something obvious and/or has anyone else had similar issues?<br /> <br /> Thanks,<br /> <br /> Sara<br /> <br /> Sara Hintze<br /> <br /> GIS Data Developer/Analyst | Research Services<br /> <br /> Mid-America Regional Council<br /> <br /> 600 Broadway Blvd., Ste 200<br /> <br /> Kansas City, MO 64105<br /> <br /> 816-701-8220 | <a href="http://www.marc.org">www.marc.org</a><br /> <br /> <br /> [2 Script.r <application/octet-stream (base64)>]<br /> [3 ConsoleOutput.txt <text/plain (base64)>]<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> # Call the acs package for data processing<br /> library(acs)<br /></blockquote> Loading required package: stringr<br /> Loading required package: XML<br /> <br /> Attaching package: ‘acs’<br /> <br /> The following object is masked from ‘package:base’:<br /> <br /> apply<br /> <br /> Warning message:<br /> package ‘acs’ was built under R version 3.3.3 <br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> # Variables to specify end year of ACS to pull from, as well as the span, which specifies the estimates to pull for that end year (1-year, 3-year, or 5-year), and the geographic level<br /> year_endyear = 2015<br /> year_span = 5 # 1-year estimates are not available at the tract or block group level<br /> fileGeo = "County"<br /> <br /> # Additional geography fields for output<br /> countyFIPS = ""<br /> countyName = ""<br /> stateFIPS = ""<br /> stateAbbr = ""<br /> <br /> if (fileGeo == "BlockGroup") {<br /></blockquote> + # Block Group Geographies<br /> + mo.geo=geo.make(state=29, county=c(3,13,21,25,37,47,49,63,95,101,107,165,177), tract="*", <a href="http://block.group">block.group</a>="*") <br /> + ks.geo=geo.make(state=20, county=c(1,5,43,45,59,91,103,107,121,209), tract="*", <a href="http://block.group">block.group</a>="*")<br /> + <br /> + # Combine the Missouri and Kansas geographies, so we're pulling all data in a single request<br /> + geo = mo.geo + ks.geo<br /> + } else if (fileGeo == "Tract") {<br /> + # Tract Geographies:<br /> + mo.geo=geo.make(state=29, county=c(3,13,21,25,37,47,49,63,95,101,107,165,177), tract="*") <br /> + ks.geo=geo.make(state=20, county=c(1,5,43,45,59,91,103,107,121,209), tract="*")<br /> + <br /> + # Combine the Missouri and Kansas geographies, so we're pulling all data in a single request<br /> + geo = mo.geo + ks.geo<br /> + } else if (fileGeo == "Place") {<br /> + # Place Geographies:<br /> + mo.geo=geo.make(state=29, place="*")<br /> + ks.geo=geo.make(state=20, place="*")<br /> + <br /> + # Combine the Missouri and Kansas geographies, so we're pulling all data in a single request<br /> + geo = mo.geo + ks.geo<br /> + } else if (fileGeo == "County") {<br /> + # County Geographies: <br /> + # Top 2 are for counties in the MSA, plus counties needed for REACH data (Allen County, KS and Lafayette County, MO)]<br /> + # Bottom 2 are the counties in the MARC region only<br /> + <br /> + #All Counties in the CSA (??) (plus Allen County, KS)<br /> + if (year_span == 5){<br /> + mo.geo=geo.make(state=29, county=c(3,13,21,25,37,47,49,63,95,101,107,165,177)) <br /> + ks.geo=geo.make(state=20, county=c(1,5,43,45,59,91,103,107,121,209))<br /> + } else {<br /> + #Counties Available within the 1-Year ACS Estimates<br /> + mo.geo=geo.make(state=29, county=c(21,37,47,95,165)) <br /> + ks.geo=geo.make(state=20, county=c(45,91,103,209))<br /> + }<br /> + <br /> + # Combine the Missouri and Kansas geographies, so we're pulling all data in a single request<br /> + geo = mo.geo + ks.geo<br /> + } else if (fileGeo == "MSA") {<br /> + # MSA Geographies - cannot be pulled by County or State, so getting all<br /> + geo <- geo.make(msa="*") <br /> + # Set the stateFIPS so that data appends correctly<br /> + stateFIPS = 99<br /> + }<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> # Clean up variables that are no longer needed.<br /> if (fileGeo != "MSA") {<br /></blockquote> + rm(mo.geo, ks.geo)<br /> + }<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> # Set up acs.lookup objects for data we want to retrieve<br /> population.under18 = acs.lookup(<a href="http://table.name">table.name</a> = "B09001", span=year_span, endyear = year_endyear)<br /></blockquote> trying URL '<a href="http://web.mit.edu/eglenn/www/acs/acs-variables/acs_5yr_2015_var.xml.gz">http://web.mit.edu/eglenn/www/acs/acs-variables/acs_5yr_2015_var.xml.gz</a>'<br /> Content type 'application/xml' length 735879 bytes (718 KB)<br /> downloaded 718 KB<br /> <br /> Warning message:<br /> In acs.lookup(<a href="http://table.name">table.name</a> = "B09001", span = year_span, endyear = year_endyear) :<br /> XML variable lookup tables for this request<br /> seem to be missing from ' <a href="https://api.census.gov/data/2015/acs5/variables.xml">https://api.census.gov/data/2015/acs5/variables.xml</a> ';<br /> temporarily downloading and using archived copies instead;<br /> since this is *much* slower, recommend running<br /> acs.tables.install()<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> ownChildren.byFamilyType = acs.lookup(<a href="http://table.name">table.name</a>="B09002", span=year_span, endyear=year_endyear)<br /></blockquote> trying URL '<a href="http://web.mit.edu/eglenn/www/acs/acs-variables/acs_5yr_2015_var.xml.gz">http://web.mit.edu/eglenn/www/acs/acs-variables/acs_5yr_2015_var.xml.gz</a>'<br /> Content type 'application/xml' length 735879 bytes (718 KB)<br /> downloaded 718 KB<br /> <br /> Warning message:<br /> In acs.lookup(<a href="http://table.name">table.name</a> = "B09002", span = year_span, endyear = year_endyear) :<br /> XML variable lookup tables for this request<br /> seem to be missing from ' <a href="https://api.census.gov/data/2015/acs5/variables.xml">https://api.census.gov/data/2015/acs5/variables.xml</a> ';<br /> temporarily downloading and using archived copies instead;<br /> since this is *much* slower, recommend running<br /> acs.tables.install()<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> # Select out just those variables we want<br /> population.under18.vars = population.under18[1:10]<br /> ownchildren.byfamilytype.vars = ownChildren.byFamilyType[1:20]<br /> children.vars = population.under18.vars + ownchildren.byfamilytype.vars<br /> <br /> # Request/fetch the data, and then add to a dataframe for output<br /> children.data = acs.fetch(endyear=year_endyear, span=year_span, geography=geo, variable=children.vars, dataset="acs")<br /></blockquote> Error in if (url.test["statusMessage"] != "OK") { : <br /> missing value where TRUE/FALSE needed<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> # Create a complete FIPS code ID for the block group, tract, place, or county - this is what is used to join this data to geography<br /> if (fileGeo == "Tract") {<br /></blockquote> + myFIPS = paste(geography(children.data)$state, sprintf("%03d",geography(children.data)$county), geography(children.data)$tract, sep="")<br /> + } else if (fileGeo == "County") {<br /> + myFIPS = paste(geography(children.data)$state, sprintf("%03s",geography(children.data)$county), sep="")<br /> + } else if (fileGeo == "Place") {<br /> + myFIPS = paste(geography(children.data)$state, sprintf("%05s",geography(children.data)$place), sep="")<br /> + } else if (fileGeo == "BlockGroup") {<br /> + myFIPS = paste(geography(children.data)$state, sprintf("%03d",geography(children.data)$county), sprintf("%06d",geography(children.data)$tract), geography(children.data)$blockgroup, sep="")<br /> + } else if (fileGeo == "MSA") {<br /> + myFIPS = geography(children.data)$metropolitanstatisticalareamicropolitanstatisticalarea<br /> + }<br /> Error in geography(children.data) : object 'children.data' not found<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> if (fileGeo != "MSA" && fileGeo != "Place") {<br /></blockquote> + countyFIPS = paste(geography(children.data)$state, sprintf("%03s",geography(children.data)$county), sep="")<br /> + stateFIPS = geography(children.data)$state<br /> + } else if(fileGeo != "MSA") {<br /> + stateFIPS = geography(children.data)$state<br /> + }<br /> Error in geography(children.data) : object 'children.data' not found<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> children.df = data.frame(geography(children.data)$NAME, myFIPS, countyFIPS, countyName, stateFIPS, stateAbbr, year_endyear, year_span, estimate(children.data))<br /></blockquote> Error in geography(children.data) : object 'children.data' not found<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> # Overwrite default ACS field names with English<br /> cols_children = c("GeoStr", "FIPS", "CountyFIPS", "CountyName", "StateFIPS", "StateAbbr", "Period", "Dataset", "PopulationUnder18", "Under18InHouseholds", "AgeUnder3Years", "Age3to4", "Age5", "Age6to8", "Age9to11", "Age12to14", "Age15to17", "Under18InGroupQuarters", "OwnChildrenUnder18", "InMarriedCouples","InMarriedCouples_Under3years","InMarriedCouples_3to4years","InMarriedCouples_5years","InMarriedCouples_6to11years","InMarriedCouples_12to17years","InOtherFamilies","MaleHoH","MaleHoH_Under3years","MaleHoH_3to4years","MaleHoH_5years","MaleHoH_6to11years","MaleHoH_12to17years","FemaleHoH","FemaleHoH_Under3years","FemaleHoH_3to4years","FemaleHoH_5years","FemaleHoH_6to11years","FemaleHoH_12to17years")<br /> colnames(children.df)=cols_children<br /></blockquote> Error in colnames(children.df) = cols_children : <br /> object 'children.df' not found<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> # Set rownames to NULL, so it defaults to a sequential numeric output<br /> rownames(children.df) <- NULL<br /></blockquote> Error in rownames(children.df) <- NULL : object 'children.df' not found<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /> #Clean up unneeded variables<br /> rm(ownChildren.byFamilytype, ownchildren.byfamilytype.vars, population.under18, population.under18.vars, children.vars, children.data, children.df)<br /></blockquote> Warning messages:<br /> 1: In rm(ownChildren.byFamilytype, ownchildren.byfamilytype.vars, population.under18, :<br /> object 'ownChildren.byFamilytype' not found<br /> 2: In rm(ownChildren.byFamilytype, ownchildren.byfamilytype.vars, population.under18, :<br /> object 'children.data' not found<br /> 3: In rm(ownChildren.byFamilytype, ownchildren.byfamilytype.vars, population.under18, :<br /> object 'children.df' not found<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> <br /></blockquote> [4 <text/plain; us-ascii (7bit)>]<br /><hr /><br /> acs-r mailing list<br /> acs-r@mit.edu<br /> <a href="http://mailman.mit.edu/mailman/listinfo/acs-r">http://mailman.mit.edu/mailman/listinfo/acs-r</a><br /></blockquote><br />--<br />Ezra Haber Glenn, AICP<br />Department of Urban Studies and Planning<br />Massachusetts Institute of Technology<br />77 Massachusetts Ave., Room 7-346<br />Cambridge, MA 02139<br />eglenn@mit.edu <br /><a href="http://dusp.mit.edu/faculty/ezra-glenn">http://dusp.mit.edu/faculty/ezra-glenn</a><br />617.253.2024 (w)<br />617.721.7131 (c)<br /><br /><hr /><br />acs-r mailing list<br />acs-r@mit.edu<br /><a href="http://mailman.mit.edu/mailman/listinfo/acs-r">http://mailman.mit.edu/mailman/listinfo/acs-r</a><br /></pre></blockquote></div><br>
--<br>
Ezra Haber Glenn<br>
Department of Urban Studies and Planning<br>
Massachusetts Institute of Technology<br>
eglenn@mit.edu / 617.721.7131</body></html>