Learn R Programming

ActiSleep (version 0.2.2)

ChangeTimeVar: Reformat Time Variable

Description

Reformat the time variable to match analysis-ready format

Usage

ChangeTimeVar(datain, col_idx, format = "%Y-%m-%d %H:%M:%S")

Value

dataframe with formatted time values

Arguments

datain

input dataset, must be a data frame

col_idx

index of column to convert to date object

format

format of input date data, default is YYYY-MM-DD HH:MM:SS

Examples

Run this code
data("SleepDiary1Week")

ChangeTimeVar(
SleepDiary1Week,
col_idx = c(5:18),
format = "%Y-%m-%d %H:%M:%S")

Run the code above in your browser using DataLab