Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you add a show function? #15

Open
ScottFerson opened this issue Nov 1, 2021 · 0 comments
Open

Can you add a show function? #15

ScottFerson opened this issue Nov 1, 2021 · 0 comments

Comments

@ScottFerson
Copy link

ScottFerson commented Nov 1, 2021

Dear Isaac,

Just playing with rmetalog.

Could you shelter the list that forms the metalog class, so that when a user enters its name, she gets a controlled synopsis rather than the full, scary list? Regression results are handled this way. Note the differences between the echo, print( ) , summary( ), and str( ):

x = c(1,2,3,4,5); y = c(2,3,5,7,11); r = lm(y~x)

##########################################################

r

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept) x
-1.0 2.2

##########################################################

print(r)

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept) x
-1.0 2.2

##########################################################

summary(r)

Call:
lm(formula = y ~ x)

Residuals:
1 2 3 4 5
0.8 -0.4 -0.6 -0.8 1.0

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.0000 1.0132 -0.987 0.39644
x 2.2000 0.3055 7.201 0.00552 [two stars]

Signif. codes: 0 ‘[three stars]’ 0.001 ‘[two stars]’ 0.01 ‘[one star]’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.9661 on 3 degrees of freedom
Multiple R-squared: 0.9453, Adjusted R-squared: 0.9271
F-statistic: 51.86 on 1 and 3 DF, p-value: 0.00552

##########################################################

str(r)
List of 12
$ coefficients : Named num [1:2] -1 2.2
..- attr(, "names")= chr [1:2] "(Intercept)" "x"
$ residuals : Named num [1:5] 0.8 -0.4 -0.6 -0.8 1
..- attr(
, "names")= chr [1:5] "1" "2" "3" "4" ...
$ effects : Named num [1:5] -12.522 6.957 -0.96 -1.343 0.275
..- attr(, "names")= chr [1:5] "(Intercept)" "x" "" "" ...
$ rank : int 2
$ fitted.values: Named num [1:5] 1.2 3.4 5.6 7.8 10
..- attr(
, "names")= chr [1:5] "1" "2" "3" "4" ...
$ assign : int [1:2] 0 1
$ qr :List of 5
..$ qr : num [1:5, 1:2] -2.236 0.447 0.447 0.447 0.447 ...
.. ..- attr(, "dimnames")=List of 2
.. .. ..$ : chr [1:5] "1" "2" "3" "4" ...
.. .. ..$ : chr [1:2] "(Intercept)" "x"
.. ..- attr(
, "assign")= int [1:2] 0 1
..$ qraux: num [1:2] 1.45 1.12
..$ pivot: int [1:2] 1 2
..$ tol : num 1e-07
..$ rank : int 2
..- attr(, "class")= chr "qr"
$ df.residual : int 3
$ xlevels : Named list()
$ call : language lm(formula = y ~ x)
$ terms :Classes 'terms', 'formula' language y ~ x
.. ..- attr(
, "variables")= language list(y, x)
.. ..- attr(, "factors")= int [1:2, 1] 0 1
.. .. ..- attr(
, "dimnames")=List of 2
.. .. .. ..$ : chr [1:2] "y" "x"
etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant