Skip to content

Instantly share code, notes, and snippets.

@gshotwell
Created August 3, 2017 15:36
Show Gist options
  • Save gshotwell/c0eeebcdb0feea0fb02e65587eb927ff to your computer and use it in GitHub Desktop.
Save gshotwell/c0eeebcdb0feea0fb02e65587eb927ff to your computer and use it in GitHub Desktop.
cut output
basic_output <- structure(list(name = "new_var", derivation = structure(list(
`function` = "case", args = list(structure(list(column = structure(1:3, class = "AsIs"),
type = structure(list(value = structure(list(class = "categorical",
categories = list(structure(list(id = 1L, name = "one",
numeric_value = NULL, missing = FALSE), .Names = c("id",
"name", "numeric_value", "missing")), structure(list(
id = 2L, name = "two", numeric_value = NULL,
missing = FALSE), .Names = c("id", "name", "numeric_value",
"missing")), structure(list(id = 3L, name = "three",
numeric_value = NULL, missing = FALSE), .Names = c("id",
"name", "numeric_value", "missing")))), .Names = c("class",
"categories"))), .Names = "value")), .Names = c("column",
"type")), structure(list(`function` = "and", args = list(
structure(list(`function` = "<=", args = list(structure(list(
value = -1.4998629), .Names = "value"), structure(list(
variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"), .Names = "variable"))), .Names = c("function",
"args")), structure(list(`function` = "<", args = list(
structure(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"), .Names = "variable"),
structure(list(value = -0.4424), .Names = "value"))), .Names = c("function",
"args")))), .Names = c("function", "args")), structure(list(
`function` = "and", args = list(structure(list(`function` = "<=",
args = list(structure(list(value = -0.4424), .Names = "value"),
structure(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"), .Names = "variable"))), .Names = c("function",
"args")), structure(list(`function` = "<", args = list(
structure(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"), .Names = "variable"),
structure(list(value = 0.6119), .Names = "value"))), .Names = c("function",
"args")))), .Names = c("function", "args")), structure(list(
`function` = "and", args = list(structure(list(`function` = "<=",
args = list(structure(list(value = 0.6119), .Names = "value"),
structure(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"), .Names = "variable"))), .Names = c("function",
"args")), structure(list(`function` = "<", args = list(
structure(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"), .Names = "variable"),
structure(list(value = 1.6693629), .Names = "value"))), .Names = c("function",
"args")))), .Names = c("function", "args")))), .Names = c("function",
"args"))), .Names = c("name", "derivation"), class = "VariableDefinition")
basic_output_condensed <- list(name = "new_var", derivation = list(`function` = "case",
args = list(list(column = 1:3, type = list(value = list(class = "categorical",
categories = list(list(id = 1L, name = "one", numeric_value = NULL,
missing = FALSE), list(id = 2L, name = "two", numeric_value = NULL,
missing = FALSE), list(id = 3L, name = "three", numeric_value = NULL,
missing = FALSE))))), list(`function` = "and", args = list(
list(`function` = "<=", args = list(list(value = -1.4998629),
list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"))),
list(`function` = "<", args = list(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"),
list(value = -0.4424))))), list(`function` = "and",
args = list(list(`function` = "<=", args = list(list(
value = -0.4424), list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"))),
list(`function` = "<", args = list(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"),
list(value = 0.6119))))), list(`function` = "and",
args = list(list(`function` = "<=", args = list(list(
value = 0.6119), list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"))),
list(`function` = "<", args = list(list(variable = "https://app.crunch.io/api/datasets/1/variables/birthyr/"),
list(value = 1.6693629))))))))
all.equal(basic_output_condensed, basic_output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment