### Name: str ### Title: Compactly Display the Structure of an Arbitrary R Object ### Aliases: str str.default str.data.frame strOptions ### Keywords: print documentation utilities ### ** Examples require(stats); require(grDevices); require(graphics) ## The following examples show some of 'str' capabilities str(1:12) str(ls) str(args) #- more useful than args(args) ! str(freeny) str(str) str(.Machine, digits.d = 20) str( lsfit(1:9,1:9)) str( lsfit(1:9,1:9), max.level = 1) str( lsfit(1:9,1:9), width = 60, strict.width = "cut") str( lsfit(1:9,1:9), width = 60, strict.width = "wrap") op <- options(); str(op) # save first; # otherwise internal options() is used. need.dev <- !exists(".Device") || is.null(.Device) || .Device == "null device" { if(need.dev) postscript() str(par()) if(need.dev) graphics.off() } ch <- letters[1:12]; is.na(ch) <- 3:5 str(ch) # character NA's nchar(longch <- paste(rep(letters,100), collapse="")) str(longch) str(longch, nchar.max = 52) str(longch, strict.width = "wrap") ## Settings for narrow transcript : op <- options(width = 60, str = strOptions(strict.width = "wrap")) str(lsfit(1:9,1:9)) str(options()) ## reset to previous: options(op) ## Don't show: ##-- Some "crazy" objects str(array(1:5, dim=20)) str(factor(character(0))) str(as.data.frame(NULL)) ## End Don't show str(quote( { A+B; list(C,D) } )) ## Don't show: had.stats4 <- "package:stats4" %in% search() if(!had.stats4) rs <- ## End Don't show ## S4 classes : require(stats4) x <- 0:10; y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8) ll <- function(ymax=15, xh=6) -sum(dpois(y, lambda=ymax/(1+x/xh), log=TRUE)) fit <- mle(ll) str(fit) ## Don't show: if(!had.stats4 && rs) detach("package:stats4") ## End Don't show