Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在组中运行summarytools::freq(),而不是单独在变量上运行?_R_Frequency - Fatal编程技术网

如何在组中运行summarytools::freq(),而不是单独在变量上运行?

如何在组中运行summarytools::freq(),而不是单独在变量上运行?,r,frequency,R,Frequency,我写这篇文章是为了一次运行多个频率: freq(staff[ ,c("hispanic","race","county","disabled", "ethnicity","frail","funding","funding1","funding2","gender", "language","marital","office","outcome","problem")]) 它只运行了4个变量,告诉我它忽略了变量: Variable(s)

我写这篇文章是为了一次运行多个频率:

freq(staff[ ,c("hispanic","race","county","disabled",
              "ethnicity","frail","funding","funding1","funding2","gender",
              "language","marital","office","outcome","problem")])
它只运行了4个变量,告诉我它忽略了变量:

Variable(s) ignored: county, funding, funding1, problem
然后我一次一个单独运行,没有问题。关于为什么他们不能被纳入更大的群体,有什么想法吗<代码>“县”是字符,但
“资金”
“资金1”
“问题”
都是因素。而且,它将在集团中运行
“funding2”
(也是一个因素)

于是我试着自己去管理四个捣乱者:

freq(staff[ ,c("county", "funding", "funding1", "problem")])
得到这个:

x[[1]]中的
错误:下标超出范围

所有内容都存储在一个
“tbl_df”
中,这很有帮助。

这是一个现在应该解决的问题,但如果其他人遇到类似问题,请查看
freq.ignore.threshold
选项(使用
st_options()
设置)它决定了数值变量将被忽略的不同值的数量。(角色变量和因素不受此影响,因此这不是OP提出问题的原因)

要包含所有变量,只需将此选项设置为一个非常高的数字,如果这确实是您想要的:

library(summarytools)
st_options(freq.ignore.threshold = 999999)
在即将发布的版本(0.9.7)中,也允许使用
Inf
。出于某种原因,
checkmate::test_int
似乎不接受
Inf
,尽管文档中有相反的说明,因此需要进行一些修改

library(summarytools)
st_options(freq.ignore.threshold = Inf)

这是一个现在应该已经解决的问题,但如果其他人遇到类似问题,请查看
freq.ignore.threshold
选项(使用
st_options()
设置),该选项确定数字变量将被忽略的不同值的数量。(角色变量和因素不受此影响,因此这不是OP提出问题的原因)

要包含所有变量,只需将此选项设置为一个非常高的数字,如果这确实是您想要的:

library(summarytools)
st_options(freq.ignore.threshold = 999999)
在即将发布的版本(0.9.7)中,也允许使用
Inf
。出于某种原因,
checkmate::test_int
似乎不接受
Inf
,尽管文档中有相反的说明,因此需要进行一些修改

library(summarytools)
st_options(freq.ignore.threshold = Inf)

你还有这个问题吗?如果是这样,您可以尝试使用devtools或remotes(
remotes::install_github(“dcomtois/summarytools”)
)从github安装更新的版本。如果仍然遇到相同的问题,我邀请您打开一个问题您是否仍然存在该问题?如果是这样,您可以尝试使用devtools或remotes(
remotes::install_github(“dcomtois/summarytools”)
)从github安装更新的版本。如果仍然遇到相同的问题,我邀请您打开一个问题