Jan*_*Jan 6 markdown r r-markdown stargazer
我正在尝试用降价的观星者制作一个合适的表格。线性模型代码如下:
k <- lm(mean_p ~ P*MA, data=d)
Run Code Online (Sandbox Code Playgroud)
但是调用以下 stargazer-function 不起作用,会产生错误
NULL 的长度不能改变
并且只生成 html 代码。
stargazer(k,type="html")
Run Code Online (Sandbox Code Playgroud)
这是 dput(head(d)) 调用的输出:
structure(list(
age = c(15.1666666666667, 14.9166666666667,
13.3333333333333, 12.0833333333333, 10.9166666666667, 13.75),
gender = c("girls", "girls", "boys", "girls", "boys", "girls"),
MA = c("NM", "NM", "NM", "NM", "NM", "NM"),
AFC = c(0, 0, 0, 0, 0, 0),
test_k_1 = c(3, 3, 3, 3, 0, 0), test_k_2 = c(6, 3, 6, 6, 3, 3),
test_k_3 = c(9, 0, 6, 3, 0, 0), test_k_4 = c(3, 3, 9, 6, 0, 0),
test_u_1 = c(3, 3, 6, 3, 0, 0), test_u_2 = c(6, 3, 0, 0, 0, 0),
test_u_3 = c(9, 0, 3, 0, 0, 0), test_u_4 = c(3,0, 0, 0, 0, 0),
test_n_3 = c(6, 3, 6, 0, 0, 3), test_n_4 = c(3,0, 9, 0, 0, 3),
k = c(6, 2, 7, 5, 1, 1), b = c(6,1, 1, 0, 0, 0),
d = c(6, 2, 8, 1, 0, 3),
s = c(6,1.66666666666667,5.33333333333333, 2, 0.333333333333333, 1.33333333333333),
mean_p = c(6, 1.66666666666667, 5.33333333333333,2, 0.333333333333333, 1.33333333333333),
zc = c(-0.669549727292442,
-0.669549727292442, -0.669549727292442, -0.669549727292442,
-0.669549727292442, -0.669549727292442),
znum = c(-0.643217641381636, -0.643217641381636, -0.643217641381636, -0.643217641381636, -0.643217641381636, -0.643217641381636),
zse = c(-0.708845108492594, -0.708845108492594, -0.708845108492594, -0.708845108492594, -0.708845108492594, -0.708845108492594),
m = c(-0.669549727292442,-0.669549727292442, -0.669549727292442, -0.669549727292442, -0.669549727292442, -0.669549727292442),
P = c(-0.416305415592902, -0.442252258358532, -0.499214827082544, -0.699404516110036, -0.39383368539238, -0.702020755840638)),
row.names = c(186L,187L, 195L, 197L, 199L, 200L), class = "data.frame")
Run Code Online (Sandbox Code Playgroud)
有人知道如何解决这个问题吗?提前感谢您的任何提示。