{"id":19070363,"url":"https://github.com/ropenspain/enseresp","last_synced_at":"2025-10-29T02:37:32.751Z","repository":{"id":55897496,"uuid":"247366808","full_name":"rOpenSpain/enseResp","owner":"rOpenSpain","description":"Information on the Spanish Health Survey","archived":false,"fork":false,"pushed_at":"2024-04-14T17:01:28.000Z","size":32416,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-25T23:01:55.326Z","etag":null,"topics":["dataset","health","microdata","r","ropenspain","rstats"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rOpenSpain.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-03-14T23:03:42.000Z","updated_at":"2023-03-05T20:36:08.000Z","dependencies_parsed_at":"2022-08-15T09:00:16.179Z","dependency_job_id":"93234967-9ab5-4035-ac6c-ebb84fd8e245","html_url":"https://github.com/rOpenSpain/enseResp","commit_stats":{"total_commits":58,"total_committers":1,"mean_commits":58.0,"dds":0.0,"last_synced_commit":"f6878e3eb3f4daac5ec4372c144fbff7b735c075"},"previous_names":["ropenspain/enseresp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rOpenSpain/enseResp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rOpenSpain%2FenseResp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rOpenSpain%2FenseResp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rOpenSpain%2FenseResp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rOpenSpain%2FenseResp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rOpenSpain","download_url":"https://codeload.github.com/rOpenSpain/enseResp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rOpenSpain%2FenseResp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261967097,"owners_count":23237661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataset","health","microdata","r","ropenspain","rstats"],"created_at":"2024-11-09T01:18:19.107Z","updated_at":"2025-10-29T02:37:27.718Z","avatar_url":"https://github.com/rOpenSpain.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# enseResp \u003cimg src='man/figures/logo.png' align=\"right\" height=\"138.5\" /\u003e\n\n**Author**: Edu Gonzalo Almorox\n\n\u003c!-- badges: start --\u003e\n\n`r badger::badge_devel(\"edugonzaloalmorox/enseResp\", \"blue\")``r usethis::use_lifecycle_badge(\"experimental\")`\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\u003c!-- badges: end --\u003e\n\n`enseResp` is a R package to tidily access healthcare data from the [Spanish Health Survey](https://www.mscbs.gob.es/estadEstudios/estadisticas/bancoDatos.htm) (SHS) released by the [Spanish Health Ministry](https://www.mscbs.gob.es/home.htm). The main goal of `enseResp` is to provide data ready for analysis for researchers or other stakeholders interested in exploring health microdata in Spain. The current version of `enseResp` provides  information about the SNS editions of 2017/19, 2011/12 and 2006/07 and compiles the surveys associated with the adult, children and household samples.\n\n\n## Installation\n\nYou can install the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"edugonzaloalmorox/enseResp\")\n```\n## Load main datasets\n\nThis package contains surveys formatted to be convenient for being accessed and analysed. The current version of the package is composed of the following datsets:\n\n* `adults_19`: Dataset for adults survey for 2017/19\n* `children_19`: Dataset for children survey for 2017/19\n* `household_19`: Dataset for household survey for 2017/19\n* `adults_12`: Dataset for adults survey for 2011/12\n* `children_12`: Dataset for children survey for 2011/12\n* `household_12`: Dataset for household survey for 2011/12\n* `adults_06`: Dataset for adults survey for 2006/07\n* `children_06`: Dataset for children survey for 2006/07\n* `household_06`: Dataset for household survey for 2006/07\n\n\nThis is a basic example of how to obtain a dataset. For example, the survey of adults corresponding to 2017-19 survey. \n\n```{r adults}\nlibrary(enseResp)\nlibrary(dplyr)\n\nenseResp::adults_19\n```\n\n## Variables information\n\n\n`adults_19` contains 455 variables. `adults_19_info` provides information about the description of every variable (in Spanish). In addition it offers other information such as the type of variable, the positions in the text archive or the module the variable belongs to (for example, European Health Survey)\n\n```{r adults_info, message= FALSE, warning = FALSE}\nlibrary(enseResp)\nlibrary(dplyr)\nlibrary(knitr)\n\nenseResp::adults_19_info %\u003e% \n  select(variable_ine, descripcion_del_campo) %\u003e% \n  head(10) %\u003e% kable()\n```\n\n## Variables values\n\n\n`enseResp` also provides information on the values for each variable. This is given by the `labels` datasets. `adults_19_labels` renders information on the values associated with the variables that compose `adults_19`. For example, lets check the values in the level of physical activity (variable `T111`)\n\n```{r adults_labels}\nlibrary(enseResp)\nlibrary(dplyr)\nlibrary(knitr)\n\nenseResp::adults_19_labels %\u003e% \n  filter(variable_ine == \"T111\") %\u003e%\n kable()\n```\n\n## Example analysis\n\n```{r example}\nlibrary(enseResp)\nlibrary(dplyr)\nlibrary(knitr)\nlibrary(ggplot2)\n\nkids = enseResp::children_19\ninfo = enseResp::children_19_info\nlabels = enseResp::children_19_labels\n\n# Tidy data  --------------------------------\n\nobesity = kids %\u003e%\n  count(CCAA, IMCm) %\u003e%\n  mutate_at(vars(IMCm), as.factor) %\u003e%\n  mutate(IMCm = case_when(IMCm == \"1\"~  \"Peso insuficiente\",\n          IMCm == '2' ~ \"Normopeso\", \n          IMCm == '3' ~ \"Sobrepeso\", \n          IMCm == '4' ~ \"Obesidad\", \n          IMCm == '9' ~ \"No consta\", \n          is.na(IMCm) ~ \"No disponible\"))\n\nobesity$IMCm = factor(obesity$IMCm , levels = c(\"No disponible\", \n                                                \"No consta\", \n                                                \"Peso insuficiente\",\n                                                \"Normopeso\",\n                                                \"Sobrepeso\",\n                                                \"Obesidad\"))\n\nccaa_lab = labels %\u003e%\n  filter(variable_ine == \"CCAA\") %\u003e%\n  select(valores_ine, valores)\n\nobesity = obesity %\u003e%\n  left_join(., ccaa_lab, by = c(\"CCAA\" = \"valores_ine\"))%\u003e%\n  select(ccaa = valores, IMCm, n)\n\n# Plot ------------------------------------\n obesity %\u003e%\n  group_by(ccaa) %\u003e%\n  mutate(prop = n/sum(n)) %\u003e%\n  ungroup() %\u003e%\n  ggplot(aes(x = 2, y = prop, fill = IMCm)) +\n  geom_bar(stat = \"identity\", width = 1, alpha = 0.85) +\n  facet_wrap(facets=. ~ ccaa) +\n  xlim(0.5, 2.5) +\n  coord_polar(theta = \"y\") +\n  theme_void() +\n  scale_fill_brewer(palette = \"Dark1\") +\n   labs(title = \"Obesidad infantil\", \n       subtitle = \"Propocion IMC\") +\n  theme(legend.position = \"bottom\",\n    legend.title = element_blank(), \n    panel.background  = element_blank(),\n    strip.text.x = element_text(\n      size = 4.75, color = \"black\", face = \"bold\"\n    ))\n\n\n```\n\n# Issues and bugs\n\nIf you find issues or bugs while using `enseResp` report the bug [here](https://github.com/edugonzaloalmorox/enseResp/issues) or reach me out on \n[Twitter](https://twitter.com/EdudinGonzalo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropenspain%2Fenseresp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropenspain%2Fenseresp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropenspain%2Fenseresp/lists"}