mikera / clj-spss

SPSS .Sav file reader for Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clj-spss

SPSS .sav file reader for Clojure, intended for use by Clojure Data Scientists working with SPSS .sav files.

Builds up work by the Open Data Foundation, see: https://github.com/daxplore/spssreader

Example Usage

(require '[clj-spss.core :as sav])

;; Load an SPSS file as a SPSSFile object
(def spss (sav/load-spssfile "src/test/resources/org/opendatafoundation/data/spss/DatabaseTest.sav"))


;; Inspect numeric values in an SPSS dataset
(get-value spss "id" 0)
=> 70.0


;; Inspect variables in a .sav file
(sav/variable-info "src/test/resources/org/opendatafoundation/data/spss/VeryLongStrings.sav")
=> [{:name "ID",
     :index 0
     :format "F6.0",
     :length 6}
     .....]


;; Convert an SPSS file into a core.matrix dataset
(def data (sav/dataset-from-spss spss))


;; Write out data as a .csv file
(sav/write-csv data "out.csv")

About

SPSS .Sav file reader for Clojure

License:GNU Lesser General Public License v3.0


Languages

Language:Java 93.7%Language:Clojure 4.4%Language:XSLT 1.9%