datetime_to_col: Add a Datetime Column to Position 1

Description Usage Arguments See Also Examples

View source: R/time.R

Description

Add a Datetime Column to Position 1

Usage

1
datetime_to_col(data, var = "datetime")

Arguments

data

A dataframe or tibble.

var

Character string of new column name.

See Also

mutate,select,reexports

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(tidyverse)
test_data <- 
        tibble(Fruits = 
                       c("Apples and pears",
                         "Citrus – oranges, grapefruits, mandarins and limes",
                         "Stone fruit – nectarines, apricots, peaches and plums",
                         "Tropical and exotic – bananas and mangoes",
                         "Berries – strawberries, raspberries, blueberries, kiwifruit and passionfruit")
        )

# Datetime 
datetime_to_col(data = test_data,
                var = "test_datetime")


# Date 
date_to_col(data = test_data,
            var = "test_date")

meerapatelmd/rubix documentation built on Sept. 5, 2021, 8:30 p.m.