pretty_mctq: Make an MCTQ dataset more presentable

View source: R/pretty_mctq.R

pretty_mctqR Documentation

Make an MCTQ dataset more presentable

Description

[Maturing]

pretty_mctq() helps you to transform your Munich ChronoType Questionnaire (MCTQ) data in many ways. See the Arguments and Details section to learn more.

Usage

pretty_mctq(data, round = TRUE, hms = TRUE)

Arguments

data

A data.frame object.

round

(optional) a logical value indicating if Duration and hms objects must be rounded at the seconds level (default: TRUE).

hms

(optional) a logical value indicating if Duration and difftime objects must be converted to hms (default: TRUE).

Details

Rounding

Please note that by rounding MCTQ values you discard data. That is to say that if you need to redo a computation, or do new ones, your values can be off by a couple of seconds (see round-off error).

Round your values only if and when you want to present them more clearly, like in graphical representations. You can also round values to facilitate data exporting to text formats (like .csv), but note that this will come with a precision cost.

Note also that pretty_mctq() uses round() for rounding, which uses uses the IEC 60559 standard ("go to the even digit") for rounding off a 5. Therefore, round(0.5) is equal to 0 and round(-1.5) is equal to -2. See ?round to learn more.

Value

A transformed data.frame object, as indicated in the arguments.

See Also

Other utility functions: random_mctq(), raw_data()

Examples

data <- data.frame(
    a = 1,
    b = lubridate::duration(1.12345),
    c = hms::hms(1.12345)
    )

## Rounding time objects from `data`

pretty_mctq(data, round = TRUE, hms = FALSE)

## Converting non-'hms' time objects from 'data' to 'hms'

pretty_mctq(data, round = FALSE, hms = TRUE)

mctq documentation built on March 7, 2023, 8:22 p.m.