library("psych350data")
export_sav("superman", path = "superman_data.sav")
export_sav("hotones", path = "~/Desktop/hotones_data.sav")
# Export a subset of variables
library(dplyr)
superman |>
select(1:8) |>
export_sav(path = "superman_subset.sav")Export a dataset as an SPSS .sav file
Description
Converts a psych350data dataset to a labelled SPSS file with variable labels, value labels, and defined missing values (-99).
Usage
export_sav(dataset, path = NULL, use_sentinel = TRUE)
Arguments
dataset
|
Character string naming the dataset, or the dataset object itself. Valid names: "superman", "superman_smes", "superman_movies", "superman_combined", "hotones", "hotones_sauces", "hotones_episodes", "tip_jokes", "mcu", "mock_jury", "candy", "candy_simple", "football", "huskers", "cheese_data", "lpd_data", "parent_child_data", "hindsight_mg_data", "hindsight_wg_data", "interpersonal_data", "selfdescriptive_data" |
path
|
File path for the output .sav file. If NULL, saves to the working directory with a default name. |
use_sentinel
|
Logical. If TRUE (default), NA values are replaced with -99 and marked as SPSS user-defined missing. If FALSE, NAs are written as system-missing. |
Value
Invisibly returns the labelled data frame that was written.