bch441-work-abc-units/.utilities.R
2017-08-18 22:04:01 +02:00

45 lines
955 B
R

# .utilities.R
#
# Miscellaneous R code to suppport the project
#
# Version: 1.0
# Date: 2016 12
# Author: Boris Steipe
#
# V 1.0 First code
#
# ToDo:
# Notes:
#
# ==============================================================================
objectInfo <- function(x) {
# Function to combine various information items about R objects
#
# Input: an R object
# Value: none - prints information as side-effect
cat("object contents:")
print(x, digits = 22) # print value at maximal precision
cat("\nstructure of object:\n")
str(x)
if (! is.list(x)) { # Don't use cat() if x is a list. cat() can't handle lists.
cat("\nmode: ", mode(x), "\n")
cat("typeof: ", typeof(x), "\n")
cat("class: ", class(x), "\n")
}
# if the object has attributes, print them too
if (! is.null(attributes(x))) {
cat("\nattributes:\n")
attributes(x)
}
# Done
}
# [END]