Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Read the SPSS file formats

License

NotificationsYou must be signed in to change notification settings

JanMarvin/readspss

Repository files navigation

R-CMD-checkCodecov test coverager-universe

R package using Rcpp to parse an SPSS file into a data.frame().Currentlyread.sav andread.por are the main functions and featureof this package. Writing of SPSS files is provided bywrite.por andwrite.sav. Writing is limited to uncompressed por and sav files and tocompressed 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 frequentlytested. The read functions imports everything into a data frame.Including long strings and labels. Various features such as importing ofvalue 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 theencoding a bit more.

In comparison tohaven andforeign this package preforms prettywell. It reads more files than each of its predecessors, some are onlyreadable usingreadspss and it covers a few more cases of missingvalues.

Focus was not so much on winning every benchmark, but reading allfeatures of an SPSS file and to be as exactly as possible. So somebenchmarks are won and others are lost. It is entirely up to the task.Besides the data itselfreadspss ships additional information providedby the SPSS files like the data label, documentation, date andtimestamp.

Reading of sav and por files is considered feature complete.

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

Installation

Withremotes:

remotes::install_github("JanMarvin/readspss")

Or fromr-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

[8]ページ先頭

©2009-2025 Movatter.jp