get_graph_time {DiagrammeR}R Documentation

Get the graph date-time or timezone

Description

Set the time and timezone for a graph object of class dgr_graph.

Usage

get_graph_time(graph, as_posixct = TRUE, get_tz = FALSE)

Arguments

graph

a graph object of class dgr_graph that is created using create_graph.

as_posixct

an option to return the graph time as POSIXct.

get_tz

an option to just return the graph's time zone.

Value

a graph object of class dgr_graph.

Examples

library(magrittr)

# Create an empty graph and set the graph's time;
# if nothing is supplied for the `tz` argument,
# `GMT` is used as the time zone
graph <-
  create_graph() %>%
    set_graph_time(
      time = "2015-10-25 15:23:00")

# Get the graph's time as a POSIXct-formatted object
# using `get_graph_time()`
graph %>% get_graph_time
#> [1] "2015-10-25 15:23:00 GMT"

# Get the graph's time as a character object
graph %>% get_graph_time(as_posixct = FALSE)
#> [1] "2015-10-25 15:23:00"

# Get just the time zone associated with the
# graph time
graph %>% get_graph_time(get_tz = TRUE)
#> [1] "GMT"

[Package DiagrammeR version 0.8.4 Index]