getData(filename = NULL, file = NULL, errorMessage = "[defaultErrorMessage]", applyRioLabels = TRUE, use.value.labels = FALSE, to.data.frame = TRUE, stringsAsFactors = FALSE, ...)
getDat(..., dfName = "dat", backup = TRUE)
exportToSPSS(dat, savfile = NULL, datafile = NULL, codefile = NULL, fileEncoding = "UTF-8", newLinesInString = " |n| ")
filterBy(dat, expression, replaceOriginalDataframe = TRUE, envir = parent.frame())
useAll(dat, replaceFilteredDataframe = TRUE)
mediaan(vector)
modus(vector)
file
is still available for backward compatibility but will eventually be phased out.
dfName
, if one already exists
in the parent environment.
getData()
which creates a dataframe in
the parent environment, by default with the name 'dat'. Therefore, calling
getDat()
in the console will allow the user to select a file, and
the data from the file will then be read and be available as 'dat'. If an
object with dfName
(i.e. 'dat' by default) already exists, it will
be backed up with a warning. getDat()
therefore returns nothing.mediaan returns the median, or, in the case of a factor where the median is in between two categories, both categories.modus returns the mode.
### Open a dialogue to read an SPSS file
### (wrapped in 'if (interactive())' to prevent execution during
### the testing of the examples when building the package)
if (interactive()) {
getData();
}
### Get a median and a mode
mediaan(c(1,2,2,3,4,4,5,6,6,6,7));
modus(c(1,2,2,3,4,4,5,6,6,6,7));
### Create an example dataframe
(exampleDat <- data.frame(x=rep(8, 8), y=rep(c(0,1), each=4)));
### Filter it, replacing the original dataframe
(filterBy(exampleDat, "y=0"));
### Restore the old dataframe
(useAll(exampleDat));
Run the code above in your browser using DataLab