嗨,我是R的新手,正在尝试使用API
我已经为zillowR api编写了一个脚本,它将获取我特定街道地址的所有详细信息。
我的代码:
library(ZillowR)
set_zillow_web_service_id("my api key")
print <- GetDeepSearchResults(address='600 S. Quail Ct.', citystatezip ='67114',
rentzestimate=FALSE)
print
相同的输出是:
$request$address
[1] "600 S. Quail Ct."
$request$citystatezip
[1] "67114"
$message
$message$text
[1] "Request successfully processed"
$message$code
[1] "0"
$response
<response>
<results>
<result>
<zpid>1340244</zpid>
<links>
<homedetails>http://www.zillow.com/homedetails/600-S-Quail-Ct-Newton-KS-67114/1340244_zpid/</homedetails>
<graphsanddata>http://www.zillow.com/homedetails/600-S-Quail-Ct-Newton-KS-67114/1340244_zpid/#charts-and-data</graphsanddata>
<mapthishome>http://www.zillow.com/homes/1340244_zpid/</mapthishome>
<comparables>http://www.zillow.com/homes/comps/1340244_zpid/</comparables>
</links>
<address>
<street>600 S Quail Ct</street>
<zipcode>67114</zipcode>
<city>Newton</city>
<state>KS</state>
<latitude>38.017399</latitude>
<longitude>-97.333804</longitude>
</address>
<FIPScounty>20079</FIPScounty>
<useCode>SingleFamily</useCode>
<taxAssessmentYear>2018</taxAssessmentYear>
<taxAssessment>214800.0</taxAssessment>
<yearBuilt>1993</yearBuilt>
<lotSizeSqFt>33024</lotSizeSqFt>
<finishedSqFt>1726</finishedSqFt>
<bathrooms>3.0</bathrooms>
<bedrooms>4</bedrooms>
<totalRooms>8</totalRooms>
<lastSoldDate>06/01/2007</lastSoldDate>
<lastSoldPrice currency="USD">230000</lastSoldPrice>
<zestimate>
<amount currency="USD">228727</amount>
<last-updated>07/07/2019</last-updated>
<oneWeekChange deprecated="true"/>
<valueChange duration="30" currency="USD">450</valueChange>
<valuationRange>
<low currency="USD">215003</low>
<high currency="USD">244738</high>
</valuationRange>
<percentile>0</percentile>
</zestimate>
<localRealEstate>
<region name="Newton" id="19619" type="city">
<links>
<overview>http://www.zillow.com/local-info/KS-Newton/r_19619/</overview>
<forSaleByOwner>http://www.zillow.com/newton-ks/fsbo/</forSaleByOwner>
<forSale>http://www.zillow.com/newton-ks/</forSale>
可以看到它似乎在xml代码中。但是,当我尝试将其打印到csv write.csv(print,'printapi.csv'),
它不是按列格式的格式,它只是将其按原样写入csv,而顶部没有标题,而每个输出都位于下面。关于如何接收正确格式的任何建议?