write_scdf: Data output

View source: R/write_scdf.R

write_scdfR Documentation

Data output

Description

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

Usage

write_scdf(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 each row of x are separated by this string.

dec

The string to use for decimal points in numeric or complex columns: must be a single character.

...

Further arguments passed to write.table.

Details

This is a wrapper for the write.table function with predefined parameters.

Author(s)

Juergen Wilbert

See Also

write.table(), saveRDS()

Other io-functions: convert(), read_scdf()

Examples

## write single-case data to a .csv-file
filename <- tempfile(fileext = ".csv")
jessica <- random_scdf(design(level = .5))
write_scdf(jessica, tempfile())

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

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

jazznbass/scan documentation built on Sept. 14, 2024, 8:53 a.m.