R/database.R
ListUnpack.Rd
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.
ListUnpack(x, mutate = FALSE, vars = NULL) ListPack(x, mutate = FALSE, vars = NULL, vars.time = vars(ends_with("Time")), tz = "UTC")
x | An ojbect or a data.frame. |
---|---|
mutate | If |
vars, vars.time | A list of columns generated by |
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 |
Transformed object.
#> [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" #> [20] "T" "U" "V" "W" "X" "Y" "Z"d <- flightscanner:::ListUnpack(iris, mutate = TRUE, vars = "Species") d <- flightscanner:::ListPack(d, mutate = TRUE, vars = "Species") d$Species <- unlist(d$Species) head(d)#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa