Debugging and Inspection
Structure Summary
Inspect a Field Type
Inspection starts by checking what kind of value a record field contains.
Program
Play the script to choose a field and inspect its simple type label.
structure_summary.R
item_index <-
record <- list(count = 3, label = "ready", active = TRUE)
field <- names(record)[item_index]
kind <- class(record[[field]])[1]
label <- paste(field, kind, sep = ":")
cat(label, "\n", sep = "")
item_index <-
record <- list(count = 3, label = "ready", active = TRUE)
field <- names(record)[item_index]
kind <- class(record[[field]])[1]
label <- paste(field, kind, sep = ":")
cat(label, "\n", sep = "")
item_index <-
record <- list(count = 3, label = "ready", active = TRUE)
field <- names(record)[item_index]
kind <- class(record[[field]])[1]
label <- paste(field, kind, sep = ":")
cat(label, "\n", sep = "")
record
A small named list gives the inspection target.
field name
`names(record)[item_index]` chooses which field to inspect.
type label
`class(record[[field]])[1]` reports a compact type name.