0

当数据中没有“NA”时,我遇到了一个声称有“不完整案例”的数据库的问题。

数据

data <- structure(list(`Module #` = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 
11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 
12L, 12L), .Label = c("111", "112", "113", "114", "115", "116", 
"211", "212", "213", "214", "215", "216"), class = "factor"), 
    TimeStep = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
    10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
    12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 
    2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 
    4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 
    6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
    8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
    10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
    12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 
    2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 
    4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L), .Label = c("1", "2", 
    "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"), class = "factor"), 
    `Taxonomic Code` = c("PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC"), Site_long = structure(c(2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Hanauma Bay", 
    "Waikiki"), class = "factor"), Shelter = structure(c(2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Low", "High"
    ), class = c("ordered", "factor")), Year = structure(c(1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    3L, 3L, 3L, 3L, 4L, 1L, NA, 1L, 2L, 2L, NA, 2L, 3L, NA, 3L, 
    3L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 3L, 3L, 3L, 3L, NA, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    3L, 3L, 3L, 3L, NA, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 
    3L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L), .Label = c("17", "18", "19", 
    "20"), class = "factor"), Season = structure(c(1L, 2L, 3L, 
    4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 
    3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 
    2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 
    1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 
    4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 
    3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 
    2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 
    1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 
    4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 
    3L, 4L, 1L, 2L, 3L, 4L), .Label = c("summer", "fall", "winter", 
    "spring"), class = c("ordered", "factor")), recruits = c(1, 
    0, 0, 9, 2, 4, 15, 12, 4, 5, 3, 2, 2, 3, 1, 3, 5, 2, 5, 35, 
    3, 8, 3, 0, 0, 1, 3, 6, 7, 6, 6, 11, 3, 3, 5, 6, 9, 1, 0, 
    3, 0, 7, 14, 14, 8, 3, 7, 11, 2, 2, 0, 3, 9, 9, 7, 10, 10, 
    3, 1, 2, 3, 0, 0, 3, 4, 11, 10, 20, 10, 7, 0, 3, 0, 0, 0, 
    1, 0, 2, 4, 4, 0, 1, 13, 2, 0, 0, 0, 0, 5, 5, 0, 8, 2, 1, 
    2, 0, 2, 1, 0, 11, 12, 7, 4, 10, 11, 0, 16, 10, 0, 0, 0, 
    2, 2, 0, 1, 8, 1, 1, 5, 3, 1, 3, 0, 1, 8, 12, 22, 8, 6, 1, 
    3, 6, 0, 0, 0, 3, 9, 7, 1, 16, 4, 1, 7, 5), Settlement_Area = c(1.199256896, 
    1.199256896, 1.199256896, 1.199256896, 1.199256896, 1.199256896, 
    1.13816975, 1.124678109, 1.048225482, 1.149038015, 0.889323945, 
    0.84772472, 1.199256896, 1.199256896, 1.199256896, 1.199256896, 
    1.199256896, 1.199256896, 1.098069597, 1.199256896, 1.050099321, 
    1.131798697, 0.974770998, 1.065090032, 1.199256896, 1.199256896, 
    1.199256896, 1.199256896, 1.199256896, 1.199256896, 1.199256896, 
    1.195509219, 1.195883986, 1.052347927, 1.008500097, 1.075583531, 
    1.199256896, 1.199256896, 1.199256896, 1.199256896, 1.199256896, 
    1.199256896, 1.199256896, 1.199256896, 1.195883988, 1.162904422, 
    1.111186471, 1.188388632, 1.199256896, 1.199256896, 1.199256896, 
    1.199256896, 1.199256896, 1.199256896, 1.19363538, 1.199256896, 
    1.199256896, 1.199256896, 1.199256896, 1.197757825, 1.199256896, 
    1.199256896, 1.199256896, 1.199256896, 1.199256896, 1.199256896, 
    1.199256896, 1.199256896, 1.002503812, 1.109687398, 0.975520533, 
    1.191386773, 1.199256896, 1.199256896, 0.906938029, 0.8293611, 
    1.199256896, 1.199256896, 1.085327493, 1.065839567, 0.954908305, 
    0.877706141, 0.879205215, 1.010748704, 1.199256896, 1.199256896, 
    1.199256896, 1.199256896, 0.766025344, 0.818492832, 0.768648717, 
    0.927550256, 0.855969613, 0.752533704, 0.819242369, 0.872459394, 
    1.199256896, 1.199256896, 1.199256896, 1.199256896, 1.160281048, 
    1.148663247, 1.000629974, 1.199256896, 1.025739415, 0.940292361, 
    1.048975018, 1.147538942, 1.199256896, 1.199256896, 1.199256896, 
    1.199256896, 0.933921309, 0.731546706, 0.677954916, 0.82411435, 
    0.662589436, 0.707936338, 0.625862193, 0.70943541, 1.199256896, 
    1.199256896, 1.199256896, 1.199256896, 1.199256896, 1.199256896, 
    1.165527798, 1.199256896, 1.182017581, 1.017494524, 1.119056591, 
    1.198507361, 1.199256896, 1.199256896, 1.199256896, 1.199256896, 
    1.199256896, 1.03848152, 1.199256896, 1.194010148, 0.967650408, 
    0.935795148, 0.918930598, 1.10931263), recruits_per_meter_squared = c(0.833849697538033, 
    0, 0, 7.50464727784229, 1.66769939507607, 3.33539879015213, 
    13.1790534759863, 10.6697195437277, 3.81597286908925, 4.35146612620993, 
    3.37334895441278, 2.35925643409337, 1.66769939507607, 2.5015490926141, 
    0.833849697538033, 2.5015490926141, 4.16924848769016, 1.66769939507607, 
    4.55344544067183, 29.1847394138311, 2.85687262148034, 7.06839477833398, 
    3.07764593546104, 0, 0, 0.833849697538033, 2.5015490926141, 
    5.0030981852282, 5.83694788276623, 5.0030981852282, 5.0030981852282, 
    9.20110010460739, 2.50860454284902, 2.85076819465241, 4.95785772839643, 
    5.57836730209288, 7.50464727784229, 0.833849697538033, 0, 
    2.5015490926141, 0, 5.83694788276623, 11.6738957655325, 11.6738957655325, 
    6.68961210307634, 2.57974769314275, 6.29957273840855, 9.25623125617378, 
    1.66769939507607, 1.66769939507607, 0, 2.5015490926141, 7.50464727784229, 
    7.50464727784229, 5.86443742979535, 8.33849697538033, 8.33849697538033, 
    2.5015490926141, 0.833849697538033, 1.66978662819423, 2.5015490926141, 
    0, 0, 2.5015490926141, 3.33539879015213, 9.17234667291836, 
    8.33849697538033, 16.6769939507607, 9.9750244141715, 6.30808281018255, 
    0, 2.51807395212705, 0, 0, 0, 1.20574741207419, 0, 1.66769939507607, 
    3.68552351783094, 3.75291002871917, 0, 1.13933348906579, 
    14.7860815407015, 1.97873120399272, 0, 0, 0, 0, 6.52719918363432, 
    6.10878898937016, 0, 8.62486959412795, 2.336531542271, 1.32884413639499, 
    2.44127998707059, 0, 1.66769939507607, 0.833849697538033, 
    0, 9.17234667291836, 10.3423218199458, 6.09404019696993, 
    3.99748169046953, 8.33849697538033, 10.7239712534591, 0, 
    15.252984795106, 8.7143012180235, 0, 0, 0, 1.66769939507607, 
    2.14150804861869, 0, 1.47502433627902, 9.70739072799788, 
    1.50923021960163, 1.41255639288854, 7.98897913298303, 4.22871477475307, 
    0.833849697538033, 2.5015490926141, 0, 0.833849697538033, 
    6.67079758030426, 10.0061963704564, 18.8755686803448, 6.67079758030426, 
    5.07606663085665, 0.982806272085647, 2.68082957030723, 5.00622707481227, 
    0, 0, 0, 2.5015490926141, 7.50464727784229, 6.74061104139821, 
    0.833849697538033, 13.4002211177187, 4.13372429436313, 1.06860994325224, 
    7.61755024289658, 4.50729565749197), recruits_per_meter_squared_trans = c(0.606417417116062, 
    0, 0, 2.14061275265888, 0.981216451194359, 1.46681359911608, 
    2.6517657682404, 2.45699741376699, 1.57193807449589, 1.67737056564742, 
    1.47552906673462, 1.21171965010782, 0.981216451194359, 1.25320546846756, 
    0.606417417116062, 1.25320546846756, 1.64272731773985, 0.981216451194359, 
    1.71441853526271, 3.40733647924214, 1.34985665339693, 2.08795455026992, 
    1.40551984529833, 0, 0, 0.606417417116062, 1.25320546846756, 
    1.79227570016263, 1.92234141608064, 1.79227570016263, 1.79227570016263, 
    2.32249556786735, 1.25521839228753, 1.34827265947456, 1.78471097491844, 
    1.88378658416677, 2.14061275265888, 0.606417417116062, 0, 
    1.25320546846756, 0, 1.92234141608064, 2.53954442659202, 
    2.53954442659202, 2.03987034051273, 1.27529232115324, 1.98781581745633, 
    2.32788544830298, 0.981216451194359, 0.981216451194359, 0, 
    1.25320546846756, 2.14061275265888, 2.14061275265888, 1.92635408827215, 
    2.23414531588437, 2.23414531588437, 1.25320546846756, 0.606417417116062, 
    0.981998554684824, 1.25320546846756, 0, 0, 1.25320546846756, 
    1.46681359911608, 2.31967292807609, 2.23414531588437, 2.87226401734407, 
    2.39562218348464, 1.98898096989416, 0, 1.25791366716522, 
    0, 0, 0, 0.791066413855957, 0, 0.981216451194359, 1.54447765284797, 
    1.55875706808582, 0, 0.760494326814406, 2.75912863665368, 
    1.09149743937909, 0, 0, 0, 0, 2.01852301825499, 1.9613319043251, 
    0, 2.26435033142003, 1.20493180701712, 0.845372065689377, 
    1.23584349144197, 0, 0.981216451194359, 0.606417417116062, 
    0, 2.31967292807609, 2.42854102336897, 1.95925502266889, 
    1.60893412364774, 2.23414531588437, 2.46163557090596, 0, 
    2.78827657160752, 2.27359915209253, 0, 0, 0, 0.981216451194359, 
    1.14470295488804, 0, 0.90625022881232, 2.37093422527184, 
    0.919976020688425, 0.880686929248391, 2.19599928619387, 1.65416550691258, 
    0.606417417116062, 1.25320546846756, 0, 0.606417417116062, 
    2.03742059697475, 2.398458420606, 2.98949127297859, 2.03742059697475, 
    1.8043575509105, 0.684513150406024, 1.30313815348998, 1.79279677684048, 
    0, 0, 0, 1.25320546846756, 2.14061275265888, 2.04648063040265, 
    0.606417417116062, 2.66724356186119, 1.63583137909093, 0.726876856704456, 
    2.15380084972511, 1.7060736964172)), row.names = c(NA, -144L
), groups = structure(list(`Module #` = structure(c(1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 
11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 
12L, 12L, 12L, 12L, 12L), .Label = c("111", "112", "113", "114", 
"115", "116", "211", "212", "213", "214", "215", "216"), class = "factor"), 
    TimeStep = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
    10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
    12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 
    2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 
    4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 
    6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
    8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
    10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 
    12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 
    2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 
    4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L), .Label = c("1", "2", 
    "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"), class = "factor"), 
    `Taxonomic Code` = c("PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC", 
    "PC", "PC", "PC", "PC", "PC", "PC", "PC", "PC"), Site_long = structure(c(2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Hanauma Bay", 
    "Waikiki"), class = "factor"), Shelter = structure(c(2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Low", "High"
    ), class = c("ordered", "factor")), Year = structure(c(1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    3L, 3L, 3L, 3L, 4L, 1L, NA, 1L, 2L, 2L, NA, 2L, 3L, NA, 3L, 
    3L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 3L, 3L, 3L, 3L, NA, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    3L, 3L, 3L, 3L, NA, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 
    3L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 
    1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L), .Label = c("17", "18", "19", 
    "20"), class = "factor"), .rows = structure(list(1L, 2L, 
        3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 
        15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 
        26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 
        37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 
        48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 
        59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 
        70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L, 
        81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 
        92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 101L, 102L, 
        103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L, 
        112L, 113L, 114L, 115L, 116L, 117L, 118L, 119L, 120L, 
        121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 129L, 
        130L, 131L, 132L, 133L, 134L, 135L, 136L, 137L, 138L, 
        139L, 140L, 141L, 142L, 143L, 144L), ptype = integer(0), class = c("vctrs_list_of", 
    "vctrs_vctr", "list"))), row.names = c(NA, 144L), class = c("tbl_df", 
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df", 
"tbl_df", "tbl", "data.frame"))

模型

################## lm original
# all corals with sides combined
# with interaction
data$Site_long <- as.factor(data$Site_long)
# factorize variables

data$Season <- as.factor(data$Season)
data$Season <-  factor(data$Season, levels = c("summer", "fall", "winter", "spring"), ordered = TRUE) 
season <- data$Season
data$Shelter <- factor(data$Shelter, levels = c("Low", "High"), ordered = TRUE)


recruitment_lm_original <- lmer(recruits_per_meter_squared_trans ~ Site_long*Shelter + (1|Year/Season), data = data, na.action = "na.fail")
summary(recruitment_lm_original)

当我在这个数据库上运行 lmer 时,我收到以下错误:

“na.fail.default 中的错误(列表(recruits_per_meter_squared_trans = c(0.606417417116062,:对象中的缺失值)”

当我查看数据库中完整案例的数量与存在的行数时,行数存在差异:

nrow(data)

nrow(data[complete.cases(data), ])

行(数据)[1] 144

nrow(数据[完整案例(数据),])[1] 139

在这里,您可以看到完整行数与总行数存在差异。尽管数据库中没有“NA”,但情况仍然如此。我希望能够运行我的模型,同时确保处理所有 144 行,而不是 139 行。因为我想在这个模型上使用 MuMin::dredge() 函数,所以我需要使用 na.action = "na. lmer() 中的“失败”参数。这里发生了什么?提前致谢!

4

0 回答 0