str_pretty
is a wrapper around str
that tries to use better, more
distinct identifiers in the object overview.
Examples
str_pretty(lm(Sepal.Length ~ ., data = iris))
#> lst [13]
#> |- coefficients = Named num [1:6] 2.171 0.496 0.829 -0.315 -0.724 ...
#> |- residuals = Named num [1:150] 0.0952 0.1432 -0.0731 -0.2894 -0.0544 ...
#> |- effects = Named num [1:150] -71.5659 -1.1884 9.1884 -1.3724 -0.0587 ...
#> |- rank = int 6
#> |- fitted.values = Named num [1:150] 5 4.76 4.77 4.89 5.05 ...
#> |- assign = int [1:6] 0 1 2 3 4 4
#> |- qr = lst [5]
#> . - qr = num [1:150, 1:6] -12.2474 0.0816 0.0816 0.0816 0.0816 ...
#> . - qraux = num [1:6] 1.08 1.02 1.11 1.02 1.02 ...
#> . - pivot = int [1:6] 1 2 3 4 5 6
#> . - tol = num 1e-07
#> . - rank = int 6
#> |- df.residual = int 144
#> |- contrasts = lst [1]
#> . - Species = chr "contr.treatment"
#> |- xlevels = lst [1]
#> . - Species = chr [1:3] "setosa" "versicolor" "virginica"
#> |- call = language lm(formula = Sepal.Length ~ ., data = iris)
#> |- terms = Classes 'terms', 'formula' language Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species
#> |- model = 'data.frame': 150 obs. of 5 variables:
#> . - Sepal.Length = num [1:150] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
#> . - Sepal.Width = num [1:150] 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
#> . - Petal.Length = num [1:150] 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
#> . - Petal.Width = num [1:150] 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
#> . - Species = Factor w/ 3 levels "setosa","versicolor",. = 1 1 1 1 1 1 1 1 1 1 ...
nst_lst <- list()
nst_lst$a <- list(c(9,2,4, 12), g=c(2,4,9,7), h=list(m=4,n=7,d=12))
nst_lst$b <- c(4, 3, 9, 10, 3, 16, 1, 7)
nst_lst$f <- c("a", "b")
nst_lst$c <- 4
nst_lst$d <- c(7,9)
str_pretty(nst_lst)
#> lst [5]
#> |- a: lst [3]
#> . - = num [1:4] 9 2 4 12
#> . - g = num [1:4] 2 4 9 7
#> . - h: lst [3]
#> . . - m = num 4
#> . . - n = num 7
#> . . - d = num 12
#> |- b = num [1:8] 4 3 9 10 3 16 1 7
#> |- f = chr [1:2] "a" "b"
#> |- c = num 4
#> |- d = num [1:2] 7 9
# Pass `str` arguments to modify behavior
str_pretty(lm(Sepal.Length ~ ., data = iris), give.attr = TRUE)
#> lst [13]
#> |- coefficients = Named num [1:6] 2.171 0.496 0.829 -0.315 -0.724 ...
#> . attr: names chr [1:6] "(Intercept)" "Sepal.Width" "Petal.Length" "Petal.Width" ...
#> |- residuals = Named num [1:150] 0.0952 0.1432 -0.0731 -0.2894 -0.0544 ...
#> . attr: names chr [1:150] "1" "2" "3" "4" ...
#> |- effects = Named num [1:150] -71.5659 -1.1884 9.1884 -1.3724 -0.0587 ...
#> . attr: names chr [1:150] "(Intercept)" "Sepal.Width" "Petal.Length" "Petal.Width" ...
#> |- rank = int 6
#> |- fitted.values = Named num [1:150] 5 4.76 4.77 4.89 5.05 ...
#> . attr: names chr [1:150] "1" "2" "3" "4" ...
#> |- assign = int [1:6] 0 1 2 3 4 4
#> |- qr = lst [5]
#> . - qr = num [1:150, 1:6] -12.2474 0.0816 0.0816 0.0816 0.0816 ...
#> . . attr: dimnames lst [2]
#> . . . - = chr [1:150] "1" "2" "3" "4" ...
#> . . . - = chr [1:6] "(Intercept)" "Sepal.Width" "Petal.Length" "Petal.Width" ...
#> . . attr: assign int [1:6] 0 1 2 3 4 4
#> . . attr: contrasts lst [1]
#> . . . - Species = chr "contr.treatment"
#> . - qraux = num [1:6] 1.08 1.02 1.11 1.02 1.02 ...
#> . - pivot = int [1:6] 1 2 3 4 5 6
#> . - tol = num 1e-07
#> . - rank = int 6
#> . attr: class chr "qr"
#> |- df.residual = int 144
#> |- contrasts = lst [1]
#> . - Species = chr "contr.treatment"
#> |- xlevels = lst [1]
#> . - Species = chr [1:3] "setosa" "versicolor" "virginica"
#> |- call = language lm(formula = Sepal.Length ~ ., data = iris)
#> |- terms = Classes 'terms', 'formula' language Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species
#> . . attr: variables language list(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species)
#> . . attr: factors int [1:5, 1:4] 0 1 0 0 0 0 0 1 0 0 ...
#> . . . attr: dimnames lst [2]
#> . . . . - = chr [1:5] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" ...
#> . . . . - = chr [1:4] "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
#> . . attr: term.labels chr [1:4] "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
#> . . attr: order int [1:4] 1 1 1 1
#> . . attr: intercept int 1
#> . . attr: response int 1
#> . . attr: .Environment <environment = 0x55f1f750b8e8>
#> . . attr: predvars language list(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species)
#> . . attr: dataClasses Named chr [1:5] "numeric" "numeric" "numeric" "numeric" ...
#> . . . attr: names chr [1:5] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" ...
#> |- model = 'data.frame': 150 obs. of 5 variables:
#> . - Sepal.Length = num [1:150] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
#> . - Sepal.Width = num [1:150] 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
#> . - Petal.Length = num [1:150] 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
#> . - Petal.Width = num [1:150] 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
#> . - Species = Factor w/ 3 levels "setosa","versicolor",. = 1 1 1 1 1 1 1 1 1 1 ...
#> . attr: terms Classes 'terms', 'formula' language Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species
#> . . . attr: variables language list(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species)
#> . . . attr: factors int [1:5, 1:4] 0 1 0 0 0 0 0 1 0 0 ...
#> . . . . attr: dimnames lst [2]
#> . . . . . - = chr [1:5] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" ...
#> . . . . . - = chr [1:4] "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
#> . . . attr: term.labels chr [1:4] "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
#> . . . attr: order int [1:4] 1 1 1 1
#> . . . attr: intercept int 1
#> . . . attr: response int 1
#> . . . attr: .Environment <environment = 0x55f1f750b8e8>
#> . . . attr: predvars language list(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width, Species)
#> . . . attr: dataClasses Named chr [1:5] "numeric" "numeric" "numeric" "numeric" ...
#> . . . . attr: names chr [1:5] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" ...
#> attr: class chr "lm"