错误:列``是不受支持的NULL类型

时间:2020-02-17 20:56:16

标签: r

structure(list(Date = c("2019.01.26", "2019.01.26", "2019.01.26", 
"2019.01.26", "2019.01.26", "2019.01.26", "2019.01.26", "2019.01.26", 
"2019.01.26", "2019.01.26", "2019.01.26", "2019.01.26", "2019.01.26", 
"2019.01.26", "2019.01.26", "2019.01.26", "2019.01.26", "2019.01.26", 
"2019.01.26", "2019.01.26"), Participant = c("CV", "CV", "CV", 
"CV", "CV", "CV", "CV", "CV", "CV", "CV", "CV", "CV", "CV", "CV", 
"CV", "CV", "CV", "CV", "CV", "CV"), Machine_ASVZ = c("A1", "A1", 
"A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", 
"A1", "A1", "A1", "A1", "A1", "A1", "A1"), Machine = c("LEG PRESS", 
"LEG PRESS", "LEG PRESS", "LEG PRESS", "LEG PRESS", "LEG PRESS", 
"LEG PRESS", "LEG PRESS", "LEG PRESS", "LEG PRESS", "LEG PRESS", 
"LEG PRESS", "LEG PRESS", "LEG PRESS", "LEG PRESS", "LEG PRESS", 
"LEG PRESS", "LEG PRESS", "LEG PRESS", "LEG PRESS"), Set = c(1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), Contraction_Mode = c("Con01", 
"Con02", "Con03", "Con04", "Con05", "Con06", "Con07", "Con08", 
"Con09", "Con10", "Con01", "Con02", "Con03", "Con04", "Con05", 
"Con06", "Con07", "Con08", "Con09", "Con10"), Time_Video_CV = c(1340, 
1160, 1220, 1260, 1560, 1020, 1060, 1100, 1060, 1040, 1080, 980, 
1020, 1000, 940, 1000, 960, 1000, 900, 980), Time_Video_GRFD = c(1360, 
1180, 1240, 1280, 1180, 1060, 1080, 1100, 1060, 1060, 1100, 980, 
1020, 1020, 980, 1020, 960, 980, 920, 1040), Time_Smartphone_1 = c(1650, 
1350, 1400, 1400, 1350, 1250, 1550, 1500, 1600, 1650, 2500, 1100, 
1100, 1150, 1100, 1200, 1350, 1450, 1200, 1600), Time_Smartphone_3 = c(1700, 
1350, 1350, 1350, 1300, 1250, 1600, 1500, 1650, 1650, 1300, 1100, 
1150, 1150, 1100, 1150, 1200, 1400, 1400, 1700), Rater_Mean = c(1350, 
1170, 1230, 1270, 1370, 1040, 1070, 1100, 1060, 1050, 1090, 980, 
1020, 1010, 960, 1010, 960, 990, 910, 1010), Smartphone_Mean = c(1675, 
1350, 1375, 1375, 1325, 1250, 1575, 1500, 1625, 1650, 1900, 1100, 
1125, 1150, 1100, 1175, 1275, 1425, 1300, 1650), Relative_Diff = c(0.241, 
0.154, 0.118, 0.083, 0.033, 0.202, 0.472, 0.364, 0.533, 0.571, 
0.743, 0.122, 0.103, 0.139, 0.146, 0.163, 0.328, 0.439, 0.429, 
0.634), RaterSmartphone_Diff = c(-325, -180, -145, -105, 45, 
-210, -505, -400, -565, -600, -810, -120, -105, -140, -140, -165, 
-315, -435, -390, -640), RaterSmartphone_Mean = c(1512.5, 1260, 
1302.5, 1322.5, 1347.5, 1145, 1322.5, 1300, 1342.5, 1350, 1495, 
1040, 1072.5, 1080, 1030, 1092.5, 1117.5, 1207.5, 1105, 1330), 
    Contraction_Mode_Levels = c("Con", "Con", "Con", "Con", "Con", 
    "Con", "Con", "Con", "Con", "Con", "Con", "Con", "Con", "Con", 
    "Con", "Con", "Con", "Con", "Con", "Con"), Rater_Diff = c(-20, 
    -20, -20, -20, 380, -40, -20, 0, 0, -20, -20, 0, 0, -20, 
    -40, -20, 0, 20, -20, -60), Smartphone_Diff = c(-50, 0, 50, 
    50, 50, 0, -50, 0, -50, 0, 1200, 0, -50, 0, 0, 50, 150, 50, 
    -200, -100), RaterSmartphone_Diff_Potential_Outlier = c(FALSE, 
    FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, 
    TRUE), Rater_Diff_Potential_Outlier = c(FALSE, FALSE, FALSE, 
    FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
    FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), 
    Smartphone_Diff_Potential_Outlier = c(FALSE, FALSE, FALSE, 
    FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 
    FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE), Normalized_Error_Smartphone = c(19.4, 
    13.33, 10.55, 7.64, 3.4, 16.8, 32.06, 26.67, 34.77, 36.36, 
    42.63, 10.91, 9.33, 12.17, 12.73, 14.04, 24.71, 30.53, 30, 
    38.79), Participant_Age_Levels = structure(c(1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L), .Label = c("old", "young"), class = "factor"), Participant_Age = c(42, 
    42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 
    42, 42, 42, 42)), row.names = c(NA, 20L), class = "data.frame")

上面,您可以找到我的data.frame。我尝试将数据按Machine和Contraction_Mode_Levels进行分组,然后针对“ young”和“ old”两个因素总结Mann-Withney-U检验。

我正在尝试进行Mann-Withney-U测试,如下所示:

wilcox<-all_data_wide_outlier_levels %>% 
  group_by(Machine,Contraction_Mode_Levels) %>% 
  summarise_each(funs(wilcox.test(.[Participant_Age_Levels == "young"], 
                                  .[Participant_Age_Levels == "old"],
                                  paired=FALSE, alternative = c("two.sided"))$parameter,
                      wilcox.test(.[Participant_Age_Levels == "young"], 
                                  .[Participant_Age_Levels == "old"],
                                  paired=FALSE, alternative = c("two.sided"))$statistic,
                      wilcox.test(.[Participant_Age_Levels == "young"], 
                                  .[Participant_Age_Levels == "old"],
                                  paired=FALSE, alternative = c("two.sided"))$p.value),
                 vars = Rater_Mean)

哪个抛出错误:

错误:列vars_$..1的类型为NULL

1 个答案:

答案 0 :(得分:1)

因为只有一个级别的数据,所以我在下面的示例中展示了如何使用扫帚获取所需的统计信息:

var firstURI = new Uri("https://localhost:44340/");
var secondURI = new Uri("https://localhost:5001/");

void RegisterTypedClient<TClient, TImplementation>(Uri apiBaseUrl)
   where TClient : class where TImplementation : class, TClient
{
   builder.Services.AddHttpClient<TClient, TImplementation>(client =>
   {
       client.BaseAddress = apiBaseUrl;
   });
}

// HTTP services
RegisterTypedClient<IFirstService, FirstService>(firstURI);
RegisterTypedClient<ISecondService, SecondService>(secondURI);

从您的代码中,我想您只对Participant_Age_Levels中“年轻”组和“老”组之间Rater_Mean的差异感兴趣,因此您可以编写library(broom) library(dplyr) df = data.frame( Machine = sample(c("LEG PRESS","Y PRESS"),100,replace=TRUE), Contraction_Mode_Levels = sample(c("Con01","Con02","Con03"),100,replace=TRUE), Rater_Mean = runif(100), Participant_Age_Levels = sample(c("young","old"),100,replace=TRUE)) df %>% group_by(Machine,Contraction_Mode_Levels) %>% do(tidy(wilcox.test(Rater_Mean ~ Participant_Age_Levels,data=. ))) # A tibble: 6 x 6 # Groups: Machine, Contraction_Mode_Levels [6] Machine Contraction_Mode_Lev… statistic p.value method alternative <fct> <fct> <dbl> <dbl> <chr> <chr> 1 LEG PRESS Con01 22 0.607 Wilcoxon rank s… two.sided 2 LEG PRESS Con02 45 0.730 Wilcoxon rank s… two.sided 3 LEG PRESS Con03 22 0.607 Wilcoxon rank s… two.sided 4 Y PRESS Con01 38 0.604 Wilcoxon rank s… two.sided 5 Y PRESS Con02 33 0.613 Wilcoxon rank s… two.sided 6 Y PRESS Con03 45 0.696 Wilcoxon rank s… two.sided