| Title: | Read 'SurveyXact' Data |
|---|---|
| Description: | Imports data from the 'SurveyXact' commercial service <https://rambollxact.com>, adds variable labels, and converts value labels to factors in the same order as exported from 'SurveyXact'. |
| Authors: | Stephan Daus [aut, cre] (ORCID: <https://orcid.org/0000-0003-0230-6997>) |
| Maintainer: | Stephan Daus <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.8.8 |
| Built: | 2026-05-14 06:40:00 UTC |
| Source: | https://github.com/nifu-no/readsx |
Checks If Filepath is Valid, Optionally Fixes It.
check_filepath(filepath = filepath)check_filepath(filepath = filepath)
filepath |
Character vector of filepaths to check. |
filepath as a named character vector
First export the data from SurveyXact either as Excel or a set of CSV-files in European format (semicolon-sep). Then import using this function while setting variable labels and value labels automatically. Can then use labelled-package or other functions in this package for further processing.
read_surveyxact( filepath = c(dataset = "dataset.csv", structure = "structure.csv", labels = "labels.csv"), trim_ws = FALSE )read_surveyxact( filepath = c(dataset = "dataset.csv", structure = "structure.csv", labels = "labels.csv"), trim_ws = FALSE )
filepath |
A character string with a path to an Excel file, or a character vector with paths to the dataset.csv, structure.csv and labels.csv-files. |
trim_ws |
Logical, default is FALSE. Whether to remove leading and ending whitespace from all files. |
data.frame.
dataset <- system.file("extdata", "ex_survey2_tab_utf16", "dataset.csv", package = "readSX", mustWork = TRUE ) labels <- system.file("extdata", "ex_survey2_tab_utf16", "labels.csv", package = "readSX", mustWork = TRUE ) structure <- system.file("extdata", "ex_survey2_tab_utf16", "structure.csv", package = "readSX", mustWork = TRUE ) ex_survey2_tab_utf16 <- read_surveyxact(filepath = c( dataset = dataset, labels = labels, structure = structure ))dataset <- system.file("extdata", "ex_survey2_tab_utf16", "dataset.csv", package = "readSX", mustWork = TRUE ) labels <- system.file("extdata", "ex_survey2_tab_utf16", "labels.csv", package = "readSX", mustWork = TRUE ) structure <- system.file("extdata", "ex_survey2_tab_utf16", "structure.csv", package = "readSX", mustWork = TRUE ) ex_survey2_tab_utf16 <- read_surveyxact(filepath = c( dataset = dataset, labels = labels, structure = structure ))
Writes Data with Respondents in CSV Format Required for SurveyXact Import
write_data_for_sx(data, filepath, overwrite = FALSE)write_data_for_sx(data, filepath, overwrite = FALSE)
data |
Data frame (or tibble). |
filepath |
Filepath as string |
overwrite |
Whether to overwrite existing file or not (default). |
Side-effect: writes file. Returns filepath.
tmpfile <- tempfile(fileext = ".csv") write_data_for_sx(mtcars, filepath=tmpfile) unlink(tmpfile)tmpfile <- tempfile(fileext = ".csv") write_data_for_sx(mtcars, filepath=tmpfile) unlink(tmpfile)