File: mids2spss.Rd

package info (click to toggle)
r-cran-mice 3.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,380 kB
  • sloc: cpp: 121; sh: 25; makefile: 2
file content (71 lines) | stat: -rw-r--r-- 2,517 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mids2spss.R
\name{mids2spss}
\alias{mids2spss}
\title{Export \code{mids} object to SPSS}
\usage{
mids2spss(
  imp,
  filename = "midsdata",
  path = getwd(),
  compress = FALSE,
  silent = FALSE
)
}
\arguments{
\item{imp}{The \code{imp} argument is an object of class \code{mids},
typically produced by the \code{mice()} function.}

\item{filename}{A character string describing the name of the output data
file and its extension.}

\item{path}{A character string containing the path of the output file. The
value in \code{path} is appended to \code{filedat}. By
default, files are written to the current \code{R} working directory. If
\code{path=NULL} then no file path appending is done.}

\item{compress}{A logical flag stating whether the resulting SPSS set should
be a compressed \code{.zsav} file.}

\item{silent}{A logical flag stating whether the location of the saved file should be
printed.}
}
\value{
The return value is \code{NULL}.
}
\description{
Converts a \code{mids} object into a format recognized by SPSS, and writes
the data and the SPSS syntax files.
}
\details{
This function automates most of the work needed to export a \code{mids}
object to SPSS. It uses \code{haven::write_sav()} to facilitate the export to an
SPSS \code{.sav} or \code{.zsav} file.

Below are some things to pay attention to.

The \code{SPSS} syntax file has the proper file names and separators set, so
in principle it should run and read the data without alteration. \code{SPSS}
is more strict than \code{R} with respect to the paths. Always use the full
path, otherwise \code{SPSS} may not be able to find the data file.

Factors in \code{R} translate into categorical variables in \code{SPSS}. The
internal coding of factor levels used in \code{R} is exported. This is
generally acceptable for \code{SPSS}. However, when the data are to be
combined with existing \code{SPSS} data, watch out for any changes in the
factor levels codes.

\code{SPSS} will recognize the data set as a multiply imputed data set, and
do automatic pooling in procedures where that is supported. Note however that
pooling is an extra option only available to those who license the
\code{MISSING VALUES} module. Without this license, \code{SPSS} will still
recognize the structure of the data, but it will not pool the multiply imputed
estimates into a single inference.
}
\seealso{
\code{\link[=mids-class]{mids}}
}
\author{
Gerko Vink, dec 2020.
}
\keyword{manip}