GithubHelp home page GithubHelp logo

xitechnixjeroen / haven Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tidyverse/haven

0.0 0.0 0.0 2.92 MB

Read SPSS, Stata and SAS files from R

Home Page: https://haven.tidyverse.org

License: Other

R 9.89% C 80.44% C++ 4.88% Ragel 4.78%

haven's Introduction

haven

CRAN status R-CMD-check Codecov test coverage

Overview

Haven enables R to read and write various data formats used by other statistical packages by wrapping the fantastic ReadStat C library written by Evan Miller. Haven is part of the tidyverse. Currently it supports:

  • SAS: read_sas() reads .sas7bdat + .sas7bcat files and read_xpt() reads SAS transport files (version 5 and version 8).

  • SPSS: read_sav() reads .sav files and read_por() reads the older .por files. write_sav() writes .sav files.

  • Stata: read_dta() reads .dta files (up to version 15). write_dta() writes .dta files (versions 8-15).

The output objects:

  • Are tibbles, which have a better print method for very long and very wide files.

  • Translate value labels into a new labelled() class, which preserves the original semantics and can easily be coerced to factors with as_factor(). Special missing values are preserved. See vignette("semantics") for more details.

  • Dates and times are converted to R date/time classes. Character vectors are not converted to factors.

Installation

# The easiest way to get haven is to install the whole tidyverse:
install.packages("tidyverse")

# Alternatively, install just haven:
install.packages("haven")

Usage

library(haven)

# SAS
read_sas("mtcars.sas7bdat")
write_sas(mtcars, "mtcars.sas7bdat")

# SPSS
read_sav("mtcars.sav")
write_sav(mtcars, "mtcars.sav")

# Stata
read_dta("mtcars.dta")
write_dta(mtcars, "mtcars.dta")

Related work

  • foreign reads from SAS XPORT, SPSS, and Stata (up to version 12) files.

  • readstat13 reads from and writes to all Stata file format versions.

  • sas7bdat reads from SAS7BDAT files.

Code of Conduct

Please note that the haven project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

haven's People

Contributors

hadley avatar jimhester avatar gorcha avatar evanmiller avatar batpigandme avatar lionel- avatar jeroen avatar markriseley avatar mikmart avatar larmarange avatar edwindj avatar gergness avatar aghaynes avatar krlmlr avatar bquast avatar urswilke avatar oscardssmith avatar oliverbock avatar dsteuer avatar zkamvar avatar thays42 avatar tklebel avatar sbae avatar rubenarslan avatar pkq avatar maxheld83 avatar biostatmatt avatar lwjohnst86 avatar lorenzwalthert avatar kwenzig avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.