Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.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
r中的lappy和fisher检验_R_Lapply - Fatal编程技术网

r中的lappy和fisher检验

r中的lappy和fisher检验,r,lapply,R,Lapply,我面临着一个与在多个变量上运行fisher测试相关的问题。如果你觉得这没什么问题,我会提前道歉。我的R编程技能不够好 我有一个带有分类变量的数据集(是、否、其他等等) 请帮我解决这个问题。我的简单目标是在所有列上运行fisher.test(使用simulate.p.value) 谢谢如果您提供了一个简单的示例输入,可以用来测试和验证可能的解决方案,那么就更容易为您提供帮助。是否有一列只观察一个响应值?我添加了一小部分数据作为示例,但实际数据包括大约45列和2000多行。希望它能更好地解释我的数据

我面临着一个与在多个变量上运行fisher测试相关的问题。如果你觉得这没什么问题,我会提前道歉。我的R编程技能不够好

我有一个带有分类变量的数据集(是、否、其他等等)

请帮我解决这个问题。我的简单目标是在所有列上运行fisher.test(使用simulate.p.value)


谢谢

如果您提供了一个简单的示例输入,可以用来测试和验证可能的解决方案,那么就更容易为您提供帮助。是否有一列只观察一个响应值?我添加了一小部分数据作为示例,但实际数据包括大约45列和2000多行。希望它能更好地解释我的数据。您应该添加一个可复制格式的数据,我们可以将其复制并最好与
dput
一起使用。没有人可以使用您共享的数据,我们必须重新键入所有数据才能使用它。了解
Age Gender  Education   Occupation  Weight  Are you suffering   If yes, then on which day did you report    Health service facilities   Have you undergone any screening test   Did you have any information before you suffered    If yes , please select your source
<45 male    law Addvocate   <100    Yes <5  Being tested for Covid-19   Yes Yes Social media
<45 male    graduation  news channel job    <70 Yes <5  Being tested for Covid-19   No  Yes Social media
<55 female  B.A house wife  <60 Yes <5  Being tested for Covid-19   Yes Yes Social media
<55 male    F.A driver  <90 Yes <5  Consultation with a doctor in a clinic  Yes Yes Any other
<45 male    M.phill     lecturer    <70 Yes <5  Being tested for Covid-19   Yes Yes Electronic media
<65 male    M.phill     retired officer <90 Yes <10 Being Quarantined by any health authority   Yes Yes Any other
<35 male    graduation  business    <60 Yes <5  Being Quarantined by any health authority   Yes Yes Newspaper
<45 male    masters business    <70 Yes <5  Consultation with a doctor in a clinic  Yes Yes Electronic media
<45 male    masters jobian  <80 Yes <5  Being tested for Covid-19   Yes Yes Newspaper

CHIS <- lapply(data[,-6], function(x) chisq.test(table(data[,6], x))); CHIS
fish <- lapply(data[,-6], function(x) fisher.test(table(data[,6], x), simulate.p.value = TRUE)); fish
fisher.test(table(data$`Are you suffering', data$Age), simulate.p.value=TRUE)