ListUnpack: Write an object to a character string or recreate it from a...

Description Usage Arguments Value Examples

Description

Writes an ASCII text representation of an R object to a character string, or uses one to recreate the object. If applying this function to a data.frame, it will do this on each rows of given columns, and also transform columns between datetime and character.

Usage

1
2
3
4
ListUnpack(x, mutate = FALSE, vars = NULL)

ListPack(x, mutate = FALSE, vars = NULL,
  vars.time = vars(ends_with("Time")), tz = "UTC")

Arguments

x

An ojbect or a data.frame.

mutate

If TRUE, apply the function on the given columns. If FALSE, apply the function on the object.

vars, vars.time

A list of columns generated by vars(), a character vector of column names, a numeric vector of column positions, or NULL. vars.time is the columns names of datetime.

tz

a character string that specifies which time zone to parse the date with. The string must be a time zone that is recognized by the user's OS. If NULL, use the current time zone.

Value

Transformed object.

Examples

1
2
3
4
5
6
s <- flightscanner:::ListUnpack(LETTERS)
flightscanner:::ListPack(s)
d <- flightscanner:::ListUnpack(iris, mutate = TRUE, vars = "Species")
d <- flightscanner:::ListPack(d, mutate = TRUE, vars = "Species")
d$Species <- unlist(d$Species)
head(d)

MinZhang95/flightscanner documentation built on July 1, 2019, 9:36 p.m.