Learn R Programming

scan (version 0.53)

writeSC: Export data into a .csv-file

Description

This function restructures and exports single-case data into a .csv-file.

Usage

writeSC(data, filename = NULL, sep = ",", dec = ".", ...)

Arguments

data

A single-case data frame. See scdf to learn about this format.

filename

A character string defining the output file name (e.g. "SC_data.csv".

sep

The field separator string. Values within rows will be separated by this string. Default is sep = ",".

dec

The string used for decimal points. Must be a single character. Default is dec = "."

Further arguments passed to write.table.

See Also

write.table, readSC, saveRDS

Examples

Run this code
# NOT RUN {
## Write single-case data to a .csv-file
filename <- tempfile()
jessica <- rSC(design_rSC(level = .5))
writeSC(jessica, filename)

## Write multiple cases to a .csv-file with semicolon as field and comma as decimal separator
writeSC(Grosche2011, filename, sep = ";", dec = ",")

## writeSC and readSC
writeSC(exampleA1B1A2B2_zvt, filename)
dat <- readSC(filename, cvar = "case", pvar = "part", dvar = "zvt", mvar = "day")
res1 <- describe(exampleA1B1A2B2_zvt)$descriptives
res2 <- describe(dat)$descriptives
all.equal(res1,res2)
# }

Run the code above in your browser using DataLab