好的,所以错误现在发生在每一行(第一个块 = 第 1 行),describe 函数实际上工作正常,但是我无法选择结果变量的子集(第 3 行),这里说的是参数子集缺少或命名左侧的列(第 4 行),这告诉我试图为小于二维的对象设置列名。此外,round(第 5 行)返回一个错误,指出不能将数值参数用于非数学函数。之前在第 2 行中发生的错误“无法将类‘‘describe’’强制转换为 data.frame”,现在我想打印它时出现。它工作了一次,最近至少没有选择结果变量的子集,但现在没有任何工作,我不明白为什么..代码保持不变。
我使用的数据集的 2 行:
structure(list(Age = c(24, 23, 44, 48, 35, 56, 64, 29, 20, 62,
35, 31, 32, 60, 57, 66, 46, 18, 52, 63, 64, 35, 54, 58, 61, 52,
52, 33, 49, 28, 22, 27, 40, 53, 18, 19, 43, 44, 26, 28, 38, 18,
50, 45, 23, 38, 50, 36, 72, 62, 33, 28, 29, 42, 48, 42, 29, 70,
27, 33, 22, 62, 67, 20, 32, 22, 32, 67, 29, 55, 49, 19, 52, 20,
30, 24, 18, 24, 23, 22, 19, 20, 29, 22, 20, 19, 21, 18, 22, 22,
18, 24, 22, 24, 19, 25, 24, 25, 20, 21, 23, 39, 60, 53, 47, 48,
40, 29, 24, 27, 21, 21, 27, 22, 20, 23, 36, 22, 25, 27, 66, 54,
54, 64, 49, 40), FTND = c(5, 7, 0, 6, 0, 6, 0, NA, 3, 4, 0, 7,
NA, 0, 4, 3, 4, 1, 0, 6, 0, 5, 0, NA, NA, 3, 0, 2, NA, 0, 0,
0, NA, NA, NA, NA, NA, 4, 0, 10, NA, NA, 8, NA, 3, 7, 0, 0, 5,
2, 0, 6, 7, 0, 4, 2, 0, NA, 0, 0, 0, 0, 0, 0, 4, 0, 0, NA, 3,
NA, NA, NA, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), row.names = c(NA,
-126L), class = "data.frame")
我用 describe 得到的数据集是一个列表列表,其中不包含结果变量,而是我原始数据集的所有变量。同样通过使用 (dput(Descriptives[5:6]) 它应该打印变量 age 和 FTND 而不是 EmQ (实际上是变量/第 9 行):
structure(list(EmQ = structure(list(descript = "EmQ", units = NULL,
format = NULL, counts = c(n = "97", missing = "29", distinct = "39",
Info = "0.998", Mean = "44.04", Gmd = "12.33", `.05` = "23.6",
`.10` = "27.6", `.25` = "38.0", `.50` = "45.0", `.75` = "50.0",
`.90` = "58.4", `.95` = "60.2"), values = list(value = c(19,
21, 22, 24, 25, 27, 28, 30, 32, 33, 34, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 64, 66), frequency = structure(c(2,
2, 1, 2, 2, 1, 1, 2, 2, 2, 3, 1, 3, 1, 2, 2, 3, 4, 3, 4,
8, 7, 3, 6, 2, 4, 3, 1, 1, 1, 1, 4, 2, 1, 2, 3, 2, 2, 1), .Dim = 39L)),
extremes = c(L1 = 19, L2 = 21, L3 = 22, L4 = 24, L5 = 25,
H5 = 59, H4 = 60, H3 = 61, H2 = 64, H1 = 66)), class = "describe"),
EmQ10 = structure(list(descript = "EmQ10", units = NULL,
format = NULL, counts = c(n = "108", missing = "18",
distinct = "19", Info = "0.993", Mean = "10.16", Gmd = "4.346",
`.05` = "4.0", `.10` = "5.7", `.25` = "7.0", `.50` = "10.0",
`.75` = "13.0", `.90` = "15.0", `.95` = "16.0"), values = list(
value = c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20), frequency = structure(c(1,
3, 4, 3, 5, 13, 10, 11, 10, 11, 5, 11, 5, 6, 5, 2,
1, 1, 1), .Dim = 19L)), extremes = c(L1 = 2, L2 = 3,
L3 = 4, L4 = 5, L5 = 6, H5 = 16, H4 = 17, H3 = 18, H2 = 19,
H1 = 20)), class = "describe")), descript = "NumericData[5:44]", dimensions = c(126L,
2L), class = "describe")
我通过 describeBy 获得的数据。还有一个列表,列表 1(?)中只有 2 个组,即对照组和患者,还包含所需的结果变量,如修剪、中位数作为我猜的属性):
structure(list(NULL, NULL), .Dim = 2L, .Dimnames = list(Group = c(NA_character_,
NA_character_)))
很抱歉,我的帖子很长,我不知道如何更好地表达它..