gpt4 book ai didi

parsing - 如何将此 API 调用(在 R 中)解析为 .txt 表格式? (与以色列:) )的 "open government"相关

转载 作者:行者123 更新时间:2023-12-02 21:02:58 28 4
gpt4 key购买 nike

以色列已经发布了预算供所有人查看,并且有一个 API 可以提取数据。但是,我不知道如何将其解析为txt/csv格式。

这是一个example link to make a call for data .

这是输出:

[
{
"parent": [
{
"budget_id": "00",
"title": "המדינה"
}
],
"net_amount_revised": 6075053,
"year": 2003,
"title": "השכלה גבוהה",
"gross_amount_used": 5942975,
"gross_amount_revised": 5942975,
"budget_id": "0021",
"net_amount_used": 5936491,
"inflation_factor": 1.15866084989269,
"net_amount_allocated": 5861591,
"gross_amount_allocated": 5861591
},
{
"parent": [
{
"budget_id": "0021",
"title": "השכלה גבוהה"
},
{
"budget_id": "00",
"title": "המדינה"
}
],
"net_amount_revised": 5364976,
"year": 2003,
"title": "השתתפות בתקציב המוסדות להשכלה גבוהה",
"gross_amount_used": 5337585,
"gross_amount_revised": 5337584,
"budget_id": "002102",
"net_amount_used": 5331101,
"inflation_factor": 1.15866084989269,
"net_amount_allocated": 4985915,
"gross_amount_allocated": 4985915
},
{
"parent": [
{
"budget_id": "0021",
"title": "השכלה גבוהה"
},
{
"budget_id": "00",
"title": "המדינה"
}
],
"net_amount_revised": 565495,
"year": 2003,
"title": "השתתפות בפעולות",
"gross_amount_used": 462490,
"gross_amount_revised": 462490,
"budget_id": "002103",
"net_amount_used": 462490,
"inflation_factor": 1.15866084989269,
"net_amount_allocated": 559293,
"gross_amount_allocated": 559293
},
{
"parent": [
{
"budget_id": "0021",
"title": "השכלה גבוהה"
},
{
"budget_id": "00",
"title": "המדינה"
}
],
"net_amount_revised": 0,
"year": 2003,
"title": "רזרבה להתייקרויות",
"gross_amount_used": 0,
"gross_amount_revised": null,
"budget_id": "002105",
"net_amount_used": null,
"inflation_factor": 1.15866084989269,
"net_amount_allocated": 171801,
"gross_amount_allocated": 171801
},
{
"parent": [
{
"budget_id": "0021",
"title": "השכלה גבוהה"
},
{
"budget_id": "00",
"title": "המדינה"
}
],
"net_amount_revised": 108000,
"year": 2003,
"title": "פיתוח מוסדות להשכלה גבוהה",
"gross_amount_used": 108000,
"gross_amount_revised": 108000,
"budget_id": "002106",
"net_amount_used": 108000,
"inflation_factor": 1.15866084989269,
"net_amount_allocated": 108000,
"gross_amount_allocated": 108000
},
{
"parent": [
{
"budget_id": "0021",
"title": "השכלה גבוהה"
},
{
"budget_id": "00",
"title": "המדינה"
}
],
"net_amount_revised": 23634,
"year": 2003,
"title": "תחום פעולה כללי",
"gross_amount_used": 23634,
"gross_amount_revised": 23634,
"budget_id": "002101",
"net_amount_used": 23634,
"inflation_factor": 1.15866084989269,
"net_amount_allocated": 23634,
"gross_amount_allocated": 23634
},
{
"parent": [
{
"budget_id": "0021",
"title": "השכלה גבוהה"
},
{
"budget_id": "00",
"title": "המדינה"
}
],
"net_amount_revised": 12948,
"year": 2003,
"title": "פעולות עם משרדים ומוסדות אחרים",
"gross_amount_used": 11266,
"gross_amount_revised": 11266,
"budget_id": "002104",
"net_amount_used": 11266,
"inflation_factor": 1.15866084989269,
"net_amount_allocated": 12948,
"gross_amount_allocated": 12948
}
]

如何将其解析为表格格式?

谢谢!

塔尔

最佳答案

如果您安装the rjson package您应该能够执行以下操作:

do.call( 'rbind', fromJSON( file="http://budget.yeda.us/0021?year=2003&depth=1" ) )

[编辑]

实际上..可变长度内部parent列表有问题,但应该可以让你完成一半

关于parsing - 如何将此 API 调用(在 R 中)解析为 .txt 表格式? (与以色列:) )的 "open government"相关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5351907/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com