Read single-case data from files
Use the readSC
function to import single-case data from structured
.csv or the readSC.excel
function for importing excel files.
readSC( filename = NULL, data = NULL, sep = ",", dec = ".", sort.labels = FALSE, cvar = "case", pvar = "phase", dvar = "values", mvar = "mt", phase.names = NULL, type = "csv", ... ) readSC.excel(...)
filename |
A character string defining the file to be imported (e.g.
|
data |
A data frame. As an alternative to |
sep |
The field separator string. Values within rows have to be
separated by this string. Default is |
dec |
The string used for decimal points in the file. Must be a single
character. Default is |
sort.labels |
If set TRUE, the resulting list is sorted by label names (alphabetically increasing). |
cvar |
Sets the variable name of the "case" variable. Deafults to |
pvar |
Sets the variable name of the "phase" variable. Deafults to |
dvar |
Sets the variable name of the "values" variable. Deafults to |
mvar |
Sets the variable name of the "mt" variable. Deafults to |
phase.names |
A character vector with phase names. Deafults to the phase names provided in the phase variable. |
type |
Format of the file to be imported. Either "csv" or "excel" is possible. |
... |
Further arguments passed to the |
Returns a single-case data frame. See scdf
to learn
about the format of these data frames.
Juergen Wilbert
## Read SC-data from a file named "study1.csv" in your working directory # study1 <- readSC("study1.csv") ## Read SC-data from a .csv-file with semicolon as field and comma as decimal separator # study2 <- readSC("study2.csv", sep = ";", dec = ",") ## writeSc and readSC filename <- file.path(tempdir(),"test.csv") writeSC(exampleA1B1A2B2_zvt, filename) dat <- readSC(filename, cvar = "case", pvar = "part", dvar = "zvt", mvar = "day") res1 <- describeSC(exampleA1B1A2B2_zvt)$descriptives res2 <- describeSC(dat)$descriptives identical(res1,res2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.