{"id":13423491,"url":"https://github.com/tidyverse/haven","last_synced_at":"2025-03-15T17:31:51.355Z","repository":{"id":26848796,"uuid":"30308523","full_name":"tidyverse/haven","owner":"tidyverse","description":"Read SPSS, Stata and SAS files from R","archived":false,"fork":false,"pushed_at":"2024-10-10T23:16:37.000Z","size":8678,"stargazers_count":424,"open_issues_count":49,"forks_count":117,"subscribers_count":21,"default_branch":"main","last_synced_at":"2024-10-26T23:11:15.258Z","etag":null,"topics":["r","sas","spss","stata"],"latest_commit_sha":null,"homepage":"https://haven.tidyverse.org","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidyverse.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-04T16:28:17.000Z","updated_at":"2024-10-15T19:52:35.000Z","dependencies_parsed_at":"2023-02-16T13:35:27.737Z","dependency_job_id":"bbd96e3f-e0cd-4ee4-a53a-cc65b08fcb82","html_url":"https://github.com/tidyverse/haven","commit_stats":{"total_commits":777,"total_committers":44,"mean_commits":17.65909090909091,"dds":"0.19819819819819817","last_synced_commit":"9b3b21b5e9b64867eb53818faa7e9a22480f347d"},"previous_names":["hadley/haven"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhaven","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhaven/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhaven/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fhaven/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidyverse","download_url":"https://codeload.github.com/tidyverse/haven/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243766916,"owners_count":20344839,"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":["r","sas","spss","stata"],"created_at":"2024-07-31T00:00:35.850Z","updated_at":"2025-03-15T17:31:50.719Z","avatar_url":"https://github.com/tidyverse.png","language":"C","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# haven \u003ca href='https://haven.tidyverse.org'\u003e\u003cimg src='man/figures/logo.png' align=\"right\" height=\"139\" /\u003e\u003c/a\u003e\n\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/haven)](https://cran.r-project.org/package=haven)\n[![R-CMD-check](https://github.com/tidyverse/haven/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidyverse/haven/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/tidyverse/haven/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/haven?branch=main)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nHaven enables R to read and write various data formats used by other statistical packages by wrapping the fantastic [ReadStat](https://github.com/WizardMac/ReadStat) C library written by [Evan Miller](https://www.evanmiller.org). Haven is part of the [tidyverse](https://www.tidyverse.org/). Currently it supports:\n\n* __SAS__: `read_sas()` reads `.sas7bdat` + `.sas7bcat` files and `read_xpt()` \n  reads SAS transport files (versions 5 and 8). `write_xpt()` writes SAS\n  transport files (versions 5 and 8).\n  \n* __SPSS__: `read_sav()` reads `.sav` files and `read_por()` reads the \n  older `.por` files. `write_sav()` writes `.sav` files.\n  \n* __Stata__: `read_dta()` reads `.dta` files (up to version 15). \n  `write_dta()` writes `.dta` files (versions 8-15).\n\nThe output objects:\n\n* Are [tibbles](https://github.com/tidyverse/tibble), which have a better print\n  method for very long and very wide files.\n  \n* Translate value labels into a new `labelled()` class, which preserves the\n  original semantics and can easily be coerced to factors with `as_factor()`.\n  Special missing values are preserved. See `vignette(\"semantics\")` for \n  more details.\n\n* Dates and times are converted to R date/time classes. Character vectors are\n  not converted to factors.\n  \n## Installation\n\n```{r, eval = FALSE}\n# The easiest way to get haven is to install the whole tidyverse:\ninstall.packages(\"tidyverse\")\n\n# Alternatively, install just haven:\ninstall.packages(\"haven\")\n```\n\n## Usage\n\n```{r, eval = FALSE}\nlibrary(haven)\n\n# SAS\nread_sas(\"mtcars.sas7bdat\")\nwrite_xpt(mtcars, \"mtcars.xpt\")\n\n# SPSS\nread_sav(\"mtcars.sav\")\nwrite_sav(mtcars, \"mtcars.sav\")\n\n# Stata\nread_dta(\"mtcars.dta\")\nwrite_dta(mtcars, \"mtcars.dta\")\n```\n\n## Related work\n\n* [foreign](https://cran.r-project.org/package=foreign) reads from \n  SAS XPORT, SPSS, and Stata (up to version 12) files.\n\n* [readstat13](https://cran.r-project.org/package=readstata13) reads from \n  and writes to all Stata file format versions.\n\n* [sas7bdat](https://cran.r-project.org/package=sas7bdat) reads from\n  SAS7BDAT files.\n\n## Code of Conduct\n\nPlease note that the haven project is released with a [Contributor Code of Conduct](https://haven.tidyverse.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","funding_links":[],"categories":["C","Table of Contents","Tools"],"sub_categories":["Import Data","reading  and writing xpt file in R"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fhaven","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidyverse%2Fhaven","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fhaven/lists"}