GithubHelp home page GithubHelp logo

janmarvin / readspss Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 1.0 977 KB

Read the SPSS file formats

Home Page: https://janmarvin.github.io/readspss/

License: GNU General Public License v2.0

R 32.36% C++ 64.01% C 3.61% Shell 0.03%
r spss sav reader rcpp r-package por zsav

readspss's Introduction

readspss

R-CMD-check Codecov test coverage r-universe

R package using Rcpp to parse an SPSS file into a data.frame(). Currently read.sav and read.por are the main functions and feature of this package. Writing of SPSS files is provided by write.por and write.sav. Writing is limited to uncompressed por and sav files and to compressed sav file.

It works. Its read function is extensively tested on approximately 600+ sav-files and ~100 por-files. The code is maturing and is frequently tested. The read functions imports everything into a data frame. Including long strings and labels. Various features such as importing of value label or missings are tested and are working as intended.

The package features reading of

  • sav files,
  • zsav files,
  • encrypted sav files and
  • por files

and (experimental) writing support of (un)compressed

  • sav files and
  • zsav files and
  • por files.

Because of the R code wrapped Rcpp functions the package is pretty fast. The R code for factor conversion slows things down a bit, changing the encoding a bit more.

In comparison to haven and foreign this package preforms pretty well. It reads more files than each of its predecessors, some are only readable using readspss and it covers a few more cases of missing values.

Focus was not so much on winning every benchmark, but reading all features of an SPSS file and to be as exactly as possible. So some benchmarks are won and others are lost. It is entirely up to the task. Besides the data itself readspss ships additional information provided by the SPSS files like the data label, documentation, date and timestamp.

Reading of sav and por files is considered feature complete.

Writing of (un)compressed sav and por files is implemented and considered working. Unsupported features are reading and writing of dates (might no longer be true) and writing of long strings.

Installation

With remotes:

remotes::install_github("JanMarvin/readspss")

Or from r-universe with:

options(repos = c(
  janmarvin = 'https://janmarvin.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))
install.packages('readspss')

Usage

fls <- system.file("extdata", "electric.sav", package = "readspss")
flp <- system.file("extdata", "electric.por", package = "readspss")

df_s <- read.sav(fls)
df_p <- read.por(flp)

all.equal(df_s, df_p, check.attributes = FALSE)
#> [1] TRUE

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.