【发布时间】:2023-01-16 00:12:23
【问题描述】:
请帮助解决我在执行以下命令时遇到的错误:
stargazer(as.data.frame(st_sect.hh.earnings[st_sect.hh.earnings$sector.f=="Rural",c(1,3,4)]),
type="html",
title="Mean and Standard Deviation of Monthly Household Income by State for Rural India (Unweighted)",
summary=F, covariate.labels=c("S.No.", "State", "Mean", "Std.Dev."),
digits=0,
notes=c("Source: Periodic Labour Force Survey, 2017-18"),
out=c("tb2.state-rural.hh.earnings.html"))
【问题讨论】:
-
你能隔离错误吗?它在您的子代码中,
st_sect.hh.earnings[st_sect.hh.earnings$sector.f=="Rural",c(1,3,4)]有效吗?如果可行,它是否在数据帧转换中,as.data.frame(st_sect.hh.earnings[st_sect.hh.earnings$sector.f=="Rural",c(1,3,4)])是否有效?如果可行,则它必须在stargazer()调用中。那么,它是否可以处理前 5 行数据?你能找到一小部分数据来证明这个问题吗?然后在问题中分享? -
在这两种情况下,无论是否进行数据帧转换,我都会遇到同样的错误。我是 R 的新手。我不知道如何获取我正在使用的数据的较小子集。虽然我用谷歌搜索了这个问题,reddit 上的几个人都提到这是一个 stargazer 包问题。当我们将它分配给一个对象时它起作用
-
定义
df = as.data.frame(st_sect.hh.earnings[st_sect.hh.earnings$sector.f=="Rural",c(1,3,4)]然后运行dput(df)并将结果放在问题中。这将为我们提供您的数据的复制/粘贴版本,包括所有类和结构信息。
标签: r if-statement stargazer