periodicity: Transforms data codified as daily, weekly or monthly, to any...

Description Usage Arguments Value Author(s) Examples

Description

Diferent scores of Mediterranean Diet set cutoffs of daily, weekly or monthly consumption. Additionally, a dataset can be stored as diferent frequency of consumption. This function has been created to be called by others, it just multiplies or divides by the suitable numbre (for instance, from 'daily' to 'weekly' it just multiplies by 7)

Usage

1
periodicity(x, OriginalFreq, TargetFreq)

Arguments

x

numeric variable or a list of numeric variables, which want to be converted

OriginalFreq

character string. The frequency in which information was captured (should be provided by user). Allowed values are 'daily', 'weekly' or 'monthly'

TargetFreq

character string. The frequency in which information has to be transformed. Allowed values are 'daily', 'weekly' or 'monthly'. Usually it will be provided by another formula, depending in its scoring scheme

Value

A numeric vector, or a list of numeric vectors.

Author(s)

Miguel Menendez

Examples

1
2
3
4
5
6
7
8
9
foodA <- c(1,2,3)
foodB <- c(3,2,1)
L <- list(foodA = foodA, foodB= foodB)

# Use with a numeric variable
periodicity(foodA, "daily", "weekly")

#Use with a list
periodicity(L, "daily", "weekly")

MedDietCalc documentation built on May 31, 2019, 9:03 a.m.