Title: | Download and Manipulate Data from Istat |
---|---|
Description: | Download data from Istat (Italian Institute of Statistics) database, both old and new provider (respectively, <http://dati.istat.it/> and <https://esploradati.istat.it/databrowser/>). Additional functions for manipulating data are provided. Moreover, a 'shiny' application called 'shinyIstat' can be used to search, download and filter datasets in an easier way. |
Authors: | Elena Gradi [aut, cre], Alissa Lelli [aut], Daniela Ichim [aut] |
Maintainer: | Elena Gradi <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0 |
Built: | 2025-01-09 07:00:47 UTC |
Source: | CRAN |
Filter data set by column(s). Takes as input a data.frame (not only ISTAT ones) and allows you to select for which column(s) value(s) to filter the dataset. Alternatively, use filter_istat_interactive for an interactive version.
filter_istat(dataset, columns, datatype, lang = "ita")
filter_istat(dataset, columns, datatype, lang = "ita")
dataset |
as data.frame |
columns |
data set column(s) for which you want to filter the data. If you want to filter for more than one column, write c("column1","column2", ...) as argument. |
datatype |
column(s) value(s) for which you want to filter the data. Write as many datatype as many columns that you selected in "columns" (as in examples). |
lang |
language parameter for labels ("ita" for Italian, "eng" for English) |
It returns the filtered data set.
filter_istat(iris, columns = "Species", datatype = "setosa") #Here, #the function filters the data set 'iris' for the value 'setosa' of the column 'Species'. filter_istat(iris, columns = c("Species","Petal.Width"), datatype = list(c("virginica","setosa"), c("0.1","1.9"))) # Here, the function filters the data set 'iris' for the values 'virginica' #and 'setosa' of the column 'Species' and for the values '0.1' and '1.9' of #the column 'Petal.Width'.
filter_istat(iris, columns = "Species", datatype = "setosa") #Here, #the function filters the data set 'iris' for the value 'setosa' of the column 'Species'. filter_istat(iris, columns = c("Species","Petal.Width"), datatype = list(c("virginica","setosa"), c("0.1","1.9"))) # Here, the function filters the data set 'iris' for the values 'virginica' #and 'setosa' of the column 'Species' and for the values '0.1' and '1.9' of #the column 'Petal.Width'.
An interactive and more intuitive version of filter_istat function. It filters data set by column(s). Takes as input a data.frame (not only ISTAT ones) and allows you to select for which column(s) value(s) to filter the data set interactively.
filter_istat_interactive(dataset, lang = "ita")
filter_istat_interactive(dataset, lang = "ita")
dataset |
as data.frame |
lang |
language parameter for labels ("ita" for Italian, "eng" for English) |
It returns the filtered data set.
In this first version, language parameter works only with data sets downloaded with get_i_stat (provider I.Stat).
filter_istat_interactive(iris)
filter_istat_interactive(iris)
Download data sets from I.Stat (old ISTAT provider). Alternatively, use get_istatdata to download data sets from IstatData (new ISTAT provider). Note that in this first version of the package, only get_i_stat allows you to download variable labels, while get_istatdata has not this functionality yet. The parameters "id_dataset" to download data sets can be found using list_i_stat function or search_i_stat function.
get_i_stat(id_dataset, start_period=NULL, end_period=NULL, recent=FALSE, csv=FALSE, xlsx=FALSE, lang="both")
get_i_stat(id_dataset, start_period=NULL, end_period=NULL, recent=FALSE, csv=FALSE, xlsx=FALSE, lang="both")
id_dataset |
data set id |
start_period |
Time value for the start (NULL by default) |
end_period |
Time value for the end (NULL bu default) |
recent |
False by default, if TRUE, the function retrieves data from last 10 years |
csv |
False by default, if TRUE, the function saves the data set to directory as .csv |
xlsx |
False by default, if TRUE, the function saves the data set to directory as .xlsx |
lang |
Language parameter for labels ("ita" for Italian, "eng" for English) |
It returns the data set as data.frame. It can be saved to environment or as .csv/.xlsx.
Downloading may take some time. Future versions will speed up the process.
get_i_stat("12_60") get_i_stat("12_60", start_period=2015, end_period=2018) get_i_stat("12_60", start_period=2015, end_period=2015) get_i_stat("12_60", recent=TRUE, lang="eng")
get_i_stat("12_60") get_i_stat("12_60", start_period=2015, end_period=2018) get_i_stat("12_60", start_period=2015, end_period=2015) get_i_stat("12_60", recent=TRUE, lang="eng")
Download data sets from IstatData (new ISTAT provider). Alternatively, use get_i_stat to download data sets from I.Stat (old ISTAT provider). Note that in this first version of the package, only get_i_stat allows you to download variable labels, while get_istatdata has not this functionality yet. The parameters "agencyId","dataset_id" and "version" to download the data sets can be found using list_istatdata function or search_istatdata function.
get_istatdata(agencyId, dataset_id, version, start=NULL, end=NULL, recent=FALSE, csv=FALSE, xlsx=FALSE)
get_istatdata(agencyId, dataset_id, version, start=NULL, end=NULL, recent=FALSE, csv=FALSE, xlsx=FALSE)
agencyId |
data set agencyId |
dataset_id |
data set id |
version |
data set version |
start |
Time value for the start (NULL by default) |
end |
Time value for the end (NULL bu default) |
recent |
False by default, if TRUE, the function retrieves data from last 10 years |
csv |
False by default, if TRUE, the function saves the data set to directory as .csv |
xlsx |
False by default, if TRUE, the function saves the data set to directory as .xlsx |
It returns data set as data.frame. It can be saved to environment or as .csv/.xlsx.
Downloading may take some time. Future versions will speed up the process.
get_istatdata("IT1", "12_60_DF_DCCV_CONSACQUA_2" , "1.0",recent = TRUE) get_istatdata("IT1", "12_60_DF_DCCV_CONSACQUA_2" , "1.0", start = 2015, end = 2018)
get_istatdata("IT1", "12_60_DF_DCCV_CONSACQUA_2" , "1.0",recent = TRUE) get_istatdata("IT1", "12_60_DF_DCCV_CONSACQUA_2" , "1.0", start = 2015, end = 2018)
Obtain the complete list of available data sets (source: I.Stat)
list_i_stat(lang = "ita")
list_i_stat(lang = "ita")
lang |
language parameter for labels ("ita" for Italian, "eng" for English) |
It returns the complete list of available data sets from I.Stat with their id and name.
list_i_stat()
list_i_stat()
Obtain the complete list of available data sets (source: IstatData)
list_istatdata(lang = "ita")
list_istatdata(lang = "ita")
lang |
language parameter for labels ("ita" for Italian, "eng" for English) |
It returns the complete list of available data sets from IstatData with their agencyId, id, version and name.
list_istatdata()
list_istatdata()
Build different types of exploratory graphs (scatter plot, bar plot, pie chart). You can interactively choose the plot that you want create. Once you have chosen the plot, you can interactively choose the variables from the data set for which you want to build the plot.
plot_interactive(df)
plot_interactive(df)
df |
data set as data.frame |
It returns the chosen plot.
plot_interactive allows you to have an idea about the general trend of your data, and it's intended to be used with exploratory purpose.
if(interactive()) { plot_interactive(iris) }
if(interactive()) { plot_interactive(iris) }
Search I.Stat data sets by keywords. To download data sets, use "get_i_stat" function and insert data set id.
search_i_stat(keywords, lang = "ita")
search_i_stat(keywords, lang = "ita")
keywords |
keyword(s) to search data sets |
lang |
language parameter for labels ("ita" for Italian, "eng" for English) |
It returns a list of data sets containing the keyword(s) with their id and name.
Searching may take some time. Future versions will speed up the process.
search_i_stat(c( "incidenti", "stradali")) search_i_stat("population", lang="eng")
search_i_stat(c( "incidenti", "stradali")) search_i_stat("population", lang="eng")
Search IstatData data sets by keywords. To download data sets use "get_istatdata" function and insert agencyId, id, version.
search_istatdata(keywords, lang = "ita")
search_istatdata(keywords, lang = "ita")
keywords |
keyword(s) to search data sets |
lang |
language parameter for labels ("ita" for Italian, "eng" for English) |
It returns a list of data sets containing the keyword(s) with their agencyId, id, version and name.
Searching may take some time. Future versions will speed up the process.
search_istatdata(c( "incidenti", "stradali")) search_istatdata("population", lang="eng")
search_istatdata(c( "incidenti", "stradali")) search_istatdata("population", lang="eng")
A graphic interface that makes searching, downloading and filtering data sets from Istat easier. Call shinyIstat() to get started. This shinyApp was built using the same functions of istat package but they have been adapted for the shiny. You will find additional information and help inside the app.
shinyIstat()
shinyIstat()
It opens the app.
Calling a ShinyApp equals to calling a R function. For this reason, once called shinyIstat(), R will be busy processing it until the app will be closed. As a consequence, all other R functionalities can be processed only when the app is closed.
if(interactive()) { shinyIstat() }
if(interactive()) { shinyIstat() }