readSpss <- function (file, addLeadingZeros=FALSE, truncateSpaceChar = TRUE) {
lapply(c(addLeadingZeros, truncateSpaceChar), checkmate::assert_logical, len = 1)
if(file.exists(file) != TRUE) {
stop("Could not find file.\n")
}
dat <- eatGADS::import_spss(filePath=file.path(file))$dat
dat <- set.col.type(dat)
### Leerzeichen abschnipseln
if(isTRUE(truncateSpaceChar)) {
dat <- do.call("data.frame", list(lapply(dat, crop), stringsAsFactors = FALSE ) )
}
# Check auf alles character
stopifnot(all(sapply(dat, is.character )))
### Stelligkeitskorrektur
if(isTRUE(addLeadingZeros)) {
dat <- eatTools::addLeadingZerosToCharInt(dat)
}
return(dat)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.