我使用以下脚本来计算R中的AUC:
library(mgcv)
library(ROCR)
library(AUC)
data1=read.table("d:\\2005.txt", header=T)
GAM<-gam(tuna ~ s(chla)+s(sst)+s(ssha)+s(eke), family=binomial, data=data1)
gampred<- predict(GAM, type="response")
rp <- prediction(gampred, data1$tuna)
auc <- performance( rp, "auc")@y.values[[1]]
auc
roc <- performance( rp, "tpr", "fpr")
plot( roc )
但是当我运行脚本时,结果是:
rp <- prediction(gampred, data1$tuna)
Error in prediction(gampred, data1$tuna) :
Format of predictions is invalid.
auc <- performance( rp, "auc")@y.values[[1]]
Error in performance(rp, "auc") : object 'rp' not found
auc
function (x, min = 0, max = 1)
{
if (any(class(x) == "roc")) {
if (min != 0 || max != 1) {
x$fpr <- x$fpr[x$cutoffs >= min & x$cutoffs <= max]
x$tpr <- x$tpr[x$cutoffs >= min & x$cutoffs <= max]
}
ans <- 0
for (i in 2:length(x$fpr)) {
ans <- ans + 0.5 * abs(x$fpr[i] - x$fpr[i - 1]) *
(x$tpr[i] + x$tpr[i - 1])
}
}
else if (any(class(x) %in% c("accuracy", "sensitivity", "specificity"))) {
if (min != 0 || max != 1) {
x$cutoffs <- x$cutoffs[x$cutoffs >= min & x$cutoffs <=
max]
x$measure <- x$measure[x$cutoffs >= min & x$cutoffs <=
max]
}
ans <- 0
for (i in 2:(length(x$cutoffs))) {
ans <- ans + 0.5 * abs(x$cutoffs[i - 1] - x$cutoffs[i]) *
(x$measure[i] + x$measure[i - 1])
}
}
return(as.numeric(ans))
}
<bytecode: 0x03012f10>
<environment: namespace:AUC>
roc <- performance( rp, "tpr", "fpr")
Error in performance(rp, "tpr", "fpr") : object 'rp' not found
plot( roc )
Error in levels(labels) : argument "labels" is missing, with no default**
有人可以帮我解决这个问题吗? 提前谢谢。
数据:
structure(list(x.y.chla.sst.ssha.eke.tuna = structure(c(3L,
2L, 1L, 6L, 5L, 4L, 9L, 8L, 7L, 12L, 11L, 10L, 17L, 16L, 15L,
14L, 13L, 23L, 22L, 21L, 20L, 19L, 18L, 29L, 28L, 27L, 26L, 25L,
24L, 34L, 33L, 32L, 31L, 30L, 39L, 38L, 37L, 36L, 35L, 44L, 43L,
42L, 41L, 40L, 49L, 48L, 47L, 46L, 45L, 54L, 53L, 52L, 51L, 50L,
57L, 56L, 55L, 60L, 59L, 58L, 63L, 62L, 61L, 66L, 65L, 64L, 69L,
68L, 67L, 72L, 71L, 70L, 75L, 74L, 73L, 76L, 79L, 78L, 77L, 82L,
81L, 80L, 85L, 84L, 83L, 88L, 87L, 86L, 91L, 90L, 89L, 94L, 93L,
92L, 97L, 96L, 95L, 98L, 101L, 100L), .Label = c("140.01178,44.666668,0.21406905,19.939999,6.931947586,213.8725429,87",
"140.01178,44.675674,0.20695277,19.99,6.896174947,211.7077132,50",
"140.01178,44.684685,0.20695277,19.99,6.860499828,209.3726636,209",
"140.02354,44.666668,0.21406905,19.939999,7.035145153,207.8331119,330",
"140.02354,44.675674,0.20695277,19.99,6.999857682,205.7884775,260",
"140.02354,44.684685,0.20695277,19.99,6.964626474,203.5812475,122",
"140.03532,44.666668,0.21406905,19.939999,7.137359003,201.9548425,160",
"140.03532,44.675674,0.21123222,19.939999,7.102462907,200.0259474,71",
"140.03532,44.684685,0.21123222,19.939999,7.067582021,197.9417066,92",
"140.04709,44.666668,0.21510425,19.98,7.238725124,196.2217317,262",
"140.04709,44.675674,0.21510425,19.98,7.204128887,194.4047661,235",
"140.04709,44.684685,0.21123222,19.939999,7.169506421,192.4394054,74",
"140.05887,44.666668,0.21344402,19.779999,7.339719971,190.5945792,142",
"140.05887,44.675674,0.21510425,19.98,7.305337328,188.8872185,254",
"140.05887,44.684685,0.21123222,19.939999,7.270885549,187.0381927,327",
"140.05887,44.702702,0.21946703,19.635,7.202303493,182.9590191,159",
"140.05887,44.711712,0.21937902,19.67,7.16838445,180.7479619,121",
"140.07065,44.666668,0.21344402,19.779999,7.440562868,185.0488465,146",
"140.07065,44.675674,0.21718709,19.59,7.406311297,183.4499279,169",
"140.07065,44.684685,0.21830849,19.789999,7.371945731,181.715957,69",
"140.07065,44.693695,0.21830849,19.789999,7.337604016,179.8574348,288",
"140.07065,44.702702,0.21946703,19.635,7.303408577,177.884295,159",
"140.07065,44.711712,0.21946703,19.635,7.269451162,175.8046595,148",
"140.08241,44.666668,0.21709673,19.57,7.541386943,179.564335,35",
"140.08241,44.675674,0.21718709,19.59,7.507187689,178.0738127,71",
"140.08241,44.684685,0.21718709,19.59,7.472827883,176.4547866,214",
"140.08241,44.693695,0.21830849,19.789999,7.438446933,174.7171375,96",
"140.08241,44.702702,0.21830849,19.789999,7.40416913,172.8702264,117",
"140.08241,44.711712,0.21946703,19.635,7.370088642,170.921717,171",
"140.09419,44.675674,0.21709673,19.57,7.608618684,172.712447,34",
"140.09419,44.684685,0.21718709,19.59,7.574187768,171.2100066,99",
"140.09419,44.693695,0.23201449,19.639999,7.539687975,169.5949064,97",
"140.09419,44.702702,0.23017813,19.639999,7.505246122,167.8759085,33",
"140.09419,44.711712,0.23017813,19.68,7.470959023,166.0602137,98",
"140.10597,44.675674,0.21822685,19.449999,7.710742539,167.3468152,355",
"140.10597,44.684685,0.21822685,19.924999,7.67616669,165.9637811,122",
"140.10597,44.693695,0.23201449,19.639999,7.641471382,164.4741263,88",
"140.10597,44.702702,0.23201449,19.639999,7.606786666,162.8860187,55",
"140.10597,44.711712,0.23017813,19.68,7.572211142,161.2061627,139",
"140.11774,44.675674,0.22220613,19.449999,7.813792068,161.9473363,27",
"140.11774,44.684685,0.21822685,19.924999,7.779006143,160.6879918,289",
"140.11774,44.693695,0.21822685,19.924999,7.744046853,159.3282197,97",
"140.11774,44.702702,0.23201449,19.639999,7.709047193,157.8755748,37",
"140.11774,44.711712,0.23201449,19.844999,7.674108909,156.3362602,196",
"140.12952,44.675674,0.22220613,19.449999,7.918183529,156.5204763,77",
"140.12952,44.684685,0.22220613,19.449999,7.883091051,155.3892348,43",
"140.12952,44.693695,0.22654191,19.775,7.8477667,154.1639115,97",
"140.12952,44.702702,0.2337673,20.08,7.812347413,152.8514056,175",
"140.12952,44.711712,0.2337673,20.08,7.776938732,151.4574064,24",
"140.14128,44.675674,0.22995405,19.725,8.023526381,151.1961384,27",
"140.14128,44.684685,0.22995405,19.725,7.987934535,150.1933864,98",
"140.14128,44.693695,0.22654191,19.775,7.952049136,149.1027524,20",
"140.14128,44.702702,0.2337673,20.08,7.91601135,147.9304889,17",
"140.14128,44.711712,0.2337673,20.08,7.87993041,146.6817503,68",
"140.15306,44.702702,0.22654191,19.775,8.019952403,143.1563103,94",
"140.15306,44.711712,0.23508994,20,7.982958605,142.0502389,106",
"140.15306,44.720722,0.23149663,19.98,7.946018511,140.8781463,259",
"140.16484,44.702702,0.23154913,19.83,8.123827594,138.5239406,242",
"140.16484,44.711712,0.23508994,20,8.085712775,137.5577473,206",
"140.16484,44.720722,0.23508994,20,8.047602173,136.5294239,99",
"140.17661,44.702702,0.23154913,19.83,8.227359694,134.0304771,124",
"140.17661,44.711712,0.23508994,20,8.187942104,133.2010148,66",
"140.17661,44.720722,0.23508994,20,8.148478889,132.3131154,251",
"140.18839,44.702702,0.23154913,19.83,8.330534876,129.6617484,347",
"140.18839,44.711712,0.24385826,19.904999,8.289655608,128.9658668,37",
"140.18839,44.720722,0.24385826,19.904999,8.248680929,128.2150433,298",
"140.20015,44.702702,0.22850542,19.879999,8.432901783,125.4221787,50",
"140.20015,44.711712,0.22850542,19.879999,8.390430733,124.8561588,97",
"140.20015,44.720722,0.24385826,19.904999,8.347815102,124.2384966,191",
"140.21193,44.702702,0.23540774,19.689999,8.534618466,121.290795,139",
"140.21193,44.711712,0.22850542,19.879999,8.490446053,120.8511289,146",
"140.21193,44.720722,0.22850542,19.879999,8.446079659,120.3629563,104",
"140.22371,44.702702,0.23540774,19.689999,8.635320736,117.2683565,29",
"140.22371,44.711712,0.23926629,19.994999,8.589364567,116.9510768,88",
"140.22371,44.720722,0.2316718,19.98,8.543166068,116.5882575,269",
"140.45918,43.954956,0.18629697,20.404999,7.661917584,7.432660623,110",
"140.71822,45.18919,0.17677474,19.754999,11.01793734,45.35122418,281",
"140.71822,45.198196,0.17299914,19.664999,11.07489288,46.12752733,19",
"140.71822,45.207207,0.17299914,19.664999,11.13363743,46.90640195,57",
"140.72998,45.18919,0.17443542,19.754999,11.09371062,42.80185908,58",
"140.72998,45.198196,0.17890611,19.66,11.1501392,43.50027908,33",
"140.72998,45.207207,0.17299914,19.664999,11.20830349,44.19966996,183",
"140.74176,45.18919,0.17644899,19.594999,11.16833257,40.22151035,113",
"140.74176,45.198196,0.17443542,19.754999,11.2241949,40.83922334,354",
"140.74176,45.207207,0.17664061,19.799999,11.28173784,41.45630152,46",
"140.75352,45.18919,0.17806771,19.43,11.2412012,37.6430881,318",
"140.75352,45.198196,0.17706329,19.779999,11.29647064,38.17861602,62",
"140.75352,45.207207,0.17664061,19.799999,11.35336511,38.71191641,108",
"140.7653,45.18919,0.17806771,19.43,11.31221488,35.08201252,44",
"140.7653,45.198196,0.17706329,19.779999,11.36687291,35.53466996,62",
"140.7653,45.207207,0.17898634,19.77,11.4231013,35.98352803,217",
"140.83595,45.198196,0.1938995,19.744999,11.72824174,21.53814017,81",
"140.83595,45.207207,0.18972373,19.43,11.78076699,21.53050482,196",
"140.83595,45.216217,0.17403053,19.639999,11.83432952,21.51207243,41",
"140.84772,45.198196,0.18699715,19.75,11.77514721,19.7520616,230",
"140.84772,45.207207,0.18972373,19.43,11.82721218,19.6868364,186",
"140.84772,45.216217,0.17403053,19.639999,11.88028097,19.60998405,101",
"140.8595,45.198196,0.18699715,19.75,11.81738749,18.18797316,69",
"140.93015,43.738739,0.20111582,20.375,8.846425825,37.92590556,40",
"140.93015,43.747749,0.20542198,20.459999,8.841886649,37.76022906,187",
"140.93015,43.756756,0.20542198,20.459999,8.839063655,37.56377293,95",
"140.94191,43.738739,0.20111582,20.375,8.850224069,38.13164117,145",
"140.94191,43.747749,0.20111582,20.375,8.844848092,37.9738123,135",
"140.94191,43.756756,0.20542198,20.459999,8.841168422,37.78465713,201",
"140.95369,43.639641,0.23279232,20.57,8.989581323,37.71588064,196",
"140.95369,43.648647,0.21607372,20.744999,8.973276739,37.94343161,55",
"140.95369,43.657658,0.2112719,20.744999,8.957273508,38.13452997,73",
"140.95369,43.738739,0.19495116,20.475,8.846912644,38.29027668,318",
"140.95369,43.747749,0.19495116,20.475,8.840672503,38.1414943,17",
"140.95369,43.756756,0.19901724,20.574999,8.836115811,37.96094974,54",
"140.96547,43.648647,0.20314009,20.66,8.970752192,37.95480651,143",
"140.96547,43.657658,0.20997116,20.514999,8.954318333,38.15574555,127",
"140.96547,43.747749,0.19495116,20.475,8.830598818,38.26435485,75",
"140.96547,43.756756,0.19901724,20.574999,8.825170783,38.09320682,94",
"140.97723,43.648647,0.20314009,20.66,8.963647697,37.92794974,156",
"140.97723,43.657658,0.20314009,20.66,8.946731693,38.13762953,49",
"140.97723,43.747749,0.19495116,20.475,8.815881923,38.34387212,77",
"140.97723,43.756756,0.19819239,20.215,8.809616769,38.18238114,132",
"140.97723,43.783783,0.19640626,20.309999,8.802344602,37.50628668,67",
"140.98901,43.648647,0.18401006,20.635,8.95282401,37.86872734,72",
"140.98901,43.657658,0.20314009,20.66,8.935398232,38.08581767,218",
"140.98901,43.747749,0.19591726,20.369999,8.79766358,38.38190881,205",
"140.98901,43.756756,0.19591726,20.369999,8.790620163,38.2298756,19",
"140.98901,43.765766,0.19819239,20.215,8.785400142,38.04552973,252",
"140.98901,43.774776,0.19640626,20.215,8.782165991,37.82911175,120",
"140.98901,43.783783,0.19640626,20.309999,8.781079523,37.58092331,155",
"141.00078,43.648647,0.19001316,20.934999,8.939143829,37.78290794,17",
"141.00078,43.657658,0.17255321,20.805,8.92120791,38.00580998,222",
"141.00078,43.666668,0.18656555,20.834999,8.903512526,38.19399449,120",
"141.00078,43.747749,0.19911866,20.59,8.77714041,38.3798552,345",
"141.00078,43.756756,0.19591726,20.369999,8.769410881,38.23657736,215",
"141.00078,43.765766,0.19819239,20.215,8.763513832,38.06093315,45",
"141.00078,43.774776,0.19430849,20.375,8.759617905,37.85309754,171",
"141.00078,43.783783,0.19430849,20.375,8.757890614,37.61330906,134",
"141.01256,43.648647,0.19001316,20.934999,8.923377643,37.67566553,204",
"141.01256,43.657658,0.17255321,20.805,8.904955409,37.902562,88",
"141.01256,43.666668,0.17255321,20.805,8.886757676,38.0952448,198",
"141.01256,43.747749,0.20089835,20.605,8.755397992,38.33912971,295",
"141.01256,43.756756,0.20089835,20.549999,8.747106592,38.20345872,63",
"141.01256,43.765766,0.20120423,20.434999,8.740658514,38.03547179,31",
"141.01256,43.774776,0.20120423,20.434999,8.736227706,37.83528387,95",
"141.01256,43.783783,0.19430849,20.375,8.733987677,37.60307726,242",
"141.02434,43.648647,0.19001316,20.934999,8.906284308,37.55203544,113",
"141.02434,43.657658,0.19001316,20.934999,8.887424974,37.78087967,116",
"141.02434,43.666668,0.17557681,20.955,8.868789935,37.97602579,59",
"141.02434,43.747749,0.19216277,20.605,8.733540666,38.26096025,90",
"141.02434,43.756756,0.20089835,20.549999,8.724847146,38.13130957,22",
"141.02434,43.765766,0.20089835,20.549999,8.718010829,37.96948435,123",
"141.02434,43.774776,0.20120423,20.434999,8.713208813,37.77555791,305",
"141.02434,43.783783,0.20120423,20.434999,8.710618319,37.54966377,160",
"141.02434,43.792793,0.20133916,20.645,8.710416435,37.2917389,147",
"141.02434,44.135136,0.65986806,20.904999,10.78663495,6.004355021,207",
"141.0361,43.648647,0.18303983,21.049999,8.888601656,37.41689148,130",
"141.0361,43.657658,0.18303983,21.049999,8.869380794,37.64540699,106",
"141.0361,43.666668,0.17557681,20.955,8.850399644,37.84073472,282",
"141.0361,43.747749,0.19216277,20.605,8.712663809,38.14658912,25",
"141.0361,43.756756,0.19216277,20.605,8.703766065,38.02094534,126",
"141.0361,43.765766,0.19313708,20.424999,8.696741944,37.86336223,160",
"141.0361,43.774776,0.19806096,20.309999,8.691770032,37.67387969,73",
"141.0361,43.783783,0.20133916,20.645,8.689027802,37.45260121,18",
"141.0361,43.792793,0.20133916,20.645,8.688694456,37.19943516,287",
"141.0361,44.135136,1.0971386,20.809999,10.77785401,6.133558961,99",
"141.04788,43.648647,0.18057433,21.164999,8.870942525,37.27409309,36",
"141.04788,43.657658,0.18303983,21.049999,8.851460335,37.49976294,339",
"141.04788,43.666668,0.17557681,20.955,8.83225088,37.69272817,158",
"141.04788,43.774776,0.19806096,20.309999,8.673000089,37.52943385,17",
"141.04788,43.783783,0.19806096,20.309999,8.670343113,37.3106929,119",
"141.04788,43.792793,0.20133916,20.645,8.670110213,37.06034555,173",
"141.04788,44.135136,1.0971386,20.809999,10.77063451,6.253591541,120",
"141.04788,44.144142,1.5339916,20.869999,10.8305528,5.674814363,59",
"141.04788,44.153152,1.5339916,20.869999,10.8853211,5.184942496,136",
"141.04788,44.162163,1.3047278,21.129999,10.93987011,4.729967398,173",
"141.05966,43.648647,0.19251028,20.844999,8.853989112,37.12792905,351",
"141.05966,43.657658,0.20193259,21.359999,8.83437311,37.34797317,30",
"141.05966,43.666668,0.18898158,20.85,8.815084206,37.53574546,173",
"141.05966,43.774776,0.19313708,20.424999,8.658103492,37.34160366,197",
"141.05966,43.783783,0.19053821,20.93,8.655808149,37.12294046,195",
"141.05966,43.792793,0.1859031,20.689999,8.655945327,36.87309613,42",
"141.05966,44.144142,1.3253002,20.609999,10.82568547,5.780392307,36",
"141.05966,44.153152,1.3253002,20.609999,10.88066287,5.290831962,123",
"141.05966,44.162163,1.1539752,20.879999,10.93542356,4.835255024,51",
"141.05966,44.522522,0.24346082,20.344999,11.61577634,2.782495477,36",
"141.05966,44.531532,0.23961312,20.455,11.58686901,3.005894718,280",
"141.05966,44.540539,0.23961312,20.455,11.55777485,3.232271084,184",
"141.05966,44.549549,0.22351702,20.16,11.52871747,3.460434074,91",
"141.05966,44.558559,0.25415626,20.309999,11.49994996,3.688967377,105",
"141.07143,43.648647,0.19877863,21.305,8.838399689,36.98240307,64",
"141.07143,43.657658,0.20193259,21.359999,8.818806006,37.19373881,24",
"141.07143,43.666668,0.20193259,21.359999,8.799616425,37.37317956,20",
"141.07143,44.144142,1.4571599,20.744999,10.82335238,5.864567736,63",
"141.07143,44.153152,1.3253002,20.609999,10.87840504,5.3764398,292",
"141.07143,44.162163,1.1539752,20.879999,10.93324452,4.921372959,79",
"141.07143,44.522522,0.24346082,20.344999,11.61615139,2.805607791,25",
"141.07143,44.531532,0.23961312,20.41,11.58725504,3.031335462,24",
"141.07143,44.540539,0.25824472,20.469999,11.55816825,3.260111307,271",
"141.07143,44.549549,0.25824472,20.469999,11.52911385,3.490736117,245",
"141.07143,44.558559,0.25415626,20.309999,11.50034423,3.721782216,120",
"141.08321,43.648647,0.19877863,21.305,8.824802984,36.84104132,77",
"141.08321,43.657658,0.2017473,21.475,8.805419715,37.04020939,352",
"141.08321,43.666668,0.20193259,21.359999,8.786542192,37.20778905,28",
"141.08321,44.522522,0.2595771,20.34,11.61698541,2.819440795,76",
"141.08321,44.531532,0.26204231,20.41,11.5881704,3.046688188,63",
"141.08321,44.540539,0.26204231,20.41,11.55916237,3.277070587,30",
"141.08321,44.549549,0.25824472,20.469999,11.53018377,3.509388516,132",
"141.08321,44.558559,0.25824472,20.469999,11.50148604,3.742212078,320",
"141.09497,44.549549,0.27355286,20.42,11.5320142,3.513789685,267",
"141.09497,44.558559,0.27355286,20.42,11.50347365,3.747473231,223",
"141.10675,44.549549,0.27055037,20.18,11.5347016,3.501381845,316",
"141.10675,44.558559,0.27355286,20.42,11.50641519,3.73483204,130",
"141.10675,44.585587,0.27645251,20.285,11.42561431,4.426622716,235",
"141.11853,43.684685,0.1525851,21.129999,8.741586835,36.82438135,120",
"141.11853,43.693695,0.1525851,21.129999,8.729046755,36.83602943,59",
"141.11853,44.549549,0.27055037,20.18,11.53830004,3.469593796,136",
"141.11853,44.558559,0.27355286,20.42,11.51037616,3.701495937,173",
"141.11853,44.567566,0.25408575,20.184999,11.48297653,3.933024858,130",
"141.11853,44.576576,0.25408575,20.184999,11.45631817,4.163046154,106",
"141.11853,44.585587,0.25458956,20.174999,11.43064386,4.390218263,282",
"141.13029,44.549549,0.26705205,20.355,11.54317834,3.415522461,339",
"141.13029,44.558559,0.26472193,20.539999,11.51572797,3.644698808,158",
"141.13029,44.567566,0.26472193,20.539999,11.48880164,3.87381132,17",
"141.13029,44.576576,0.25408575,20.184999,11.462613,4.101773038,119",
"141.13029,44.585587,0.25458956,20.174999,11.43740132,4.327292265,173",
"141.14207,44.549549,0.26705205,20.355,11.55007131,3.337588301,280",
"141.14207,44.558559,0.26705205,20.355,11.52318796,3.5635908,184",
"141.14207,44.567566,0.26472193,20.539999,11.49682862,3.789928052,91",
"141.14207,44.576576,0.25408575,20.514999,11.47120378,4.015573204,105",
"141.14207,44.585587,0.24617641,20.025,11.44654818,4.239297229,36",
"141.15384,44.549549,0.2650421,20.434999,11.55906997,3.237865794,195",
"141.15384,44.558559,0.24803519,20.275,11.53283129,3.460602747,42",
"141.15384,44.567566,0.24394858,20.684999,11.50711654,3.684161471,36",
"141.15384,44.576576,0.23734182,20.514999,11.48213332,3.90758587,123",
"141.15384,44.585587,0.23734182,20.514999,11.45811073,4.129720731,51",
"141.15384,44.594593,0.24617641,20.025,11.43528877,4.349314,36",
"141.16562,44.549549,0.24803519,19.955,11.56985695,3.119269115,245",
"141.16562,44.558559,0.24803519,20.275,11.54433646,3.338577318,120",
"141.16562,44.567566,0.24394858,20.684999,11.51934077,3.559272024,351",
"141.16562,44.576576,0.24394858,20.684999,11.49507213,3.780477667,30",
"141.16562,44.585587,0.23734182,20.514999,11.4717556,4.001122489,173",
"141.16562,44.594593,0.26868454,20.115,11.44962454,4.220037473,197",
"141.1774,44.549549,0.24830458,19.955,11.58213666,2.984821722,63",
"141.1774,44.558559,0.24803519,20.275,11.55740099,3.2005131,292",
"141.1774,44.567566,0.24185605,20.27,11.53319134,3.418222734,79",
"141.1774,44.576576,0.24185605,20.27,11.50970477,3.637164047,25",
"141.1774,44.585587,0.25813076,20.215,11.48716038,3.856357233,24",
"141.1774,44.594593,0.26868454,20.115,11.46578534,4.0747252,271",
"141.18916,44.549549,0.22653444,20.205,11.59559582,2.837729788,30",
"141.18916,44.558559,0.23601794,20.064999,11.57170494,3.049596179,132",
"141.18916,44.567566,0.23601794,20.064999,11.54834152,3.264167588,320",
"141.18916,44.576576,0.24185605,20.27,11.5256966,3.480753967,64",
"141.18916,44.585587,0.25813076,20.215,11.503983,3.69847512,24",
"141.18916,44.594593,0.25813076,20.215,11.4834218,3.916352874,20",
"141.20094,44.549549,0.22653444,20.205,11.60999179,2.680433923,28",
"141.20094,44.558559,0.22653444,20.205,11.58700217,2.88822729,76",
"141.20094,44.567566,0.23601794,20.064999,11.56454176,3.099459573,63",
"141.21272,44.558559,0.22653444,20.49,11.60297482,2.719572377,77",
"141.21272,44.567566,0.24933811,19.955,11.58146697,2.927232382,352",
"141.22449,44.558559,0.23657389,20.49,11.61931467,2.546698996,267",
"141.22449,44.567566,0.24933811,19.955,11.59880162,2.750519553,223",
"141.50706,44.720722,0.15261179,20.09,11.68552006,4.224153207,235",
"141.51884,44.720722,0.13908283,20.234999,11.67453932,3.996772734,130",
"141.53061,44.720722,0.13908283,20.234999,11.66358998,3.778860629,209",
"141.53061,44.729729,0.13908283,20.234999,11.68282661,3.849945767,316",
"141.56593,44.108109,0.10060897,20.309999,11.19953557,2.834365325,87",
"141.56593,44.126125,0.11903743,20.564999,11.19564267,2.995417404,50",
"141.57771,44.108109,0.230157,20.42,11.17115465,2.98452108,330",
"141.57771,44.117119,0.14499712,20.539999,11.16886162,3.069225285,260",
"141.57771,44.126125,0.14499712,20.539999,11.16704431,3.156139853,122",
"141.58948,44.108109,0.230157,20.42,11.14314575,3.133100894,71",
"141.58948,44.126125,0.14499712,20.539999,11.14116339,3.30121221,92",
"141.61304,44.18919,0.80188,20.705,11.07728165,4.69713703,160",
"143.19073,45.144146,0.28970695,18.129999,-1.602416729,259.3030406,235",
"143.19073,45.153152,0.26766548,18.004999,-1.664676775,251.6599404,74",
"143.20251,45.135136,0.28511062,18.129999,-1.526596444,253.2258409,159",
"143.20251,45.144146,0.2642377,18.129999,-1.592592815,245.0460953,121",
"143.20251,45.153152,0.26766548,18.004999,-1.652052685,237.6412912,262",
"143.21428,45.135136,0.28511062,18.129999,-1.519086439,238.0572984,254",
"143.21428,45.144146,0.26574874,18.299999,-1.581915632,230.1056674,327",
"143.44977,45.045044,0.24503136,18.129999,-0.782421574,60.4632922,142",
"143.46153,45.045044,0.23319247,17.795,-0.726486082,54.22709068,159",
"143.46153,45.081081,0.25808454,17.885,-0.693328977,32.89311518,148",
"143.47331,45.081081,0.26686358,17.725,-0.622438609,28.83104525,288",
"143.48509,45.081081,0.26686358,17.725,-0.548848986,25.21755856,169",
"143.48509,45.090092,0.26686358,17.725,-0.537052411,21.39451963,69",
"143.49686,45.081081,0.26914901,17.99,-0.473042221,22.01656016,171",
"143.49686,45.090092,0.26914901,17.99,-0.458621848,18.5875815,146",
"143.50864,45.081081,0.26744819,17.635,-0.395305956,19.18399256,96",
"143.50864,45.090092,0.26914901,17.99,-0.378323456,16.14849716,117",
"143.5204,45.081081,0.29436004,17.389999,-0.316255974,16.68807662,35",
"143.5204,45.090092,0.30002654,17.709999,-0.296788581,14.0413452,71",
"143.5204,45.099098,0.28512514,17.709999,-0.278934791,11.55321387,214",
"143.53218,45.081081,0.29436004,17.389999,-0.236039535,14.4817322,97",
"143.53218,45.090092,0.29436004,17.389999,-0.214165229,12.21722239,33",
"143.53218,45.099098,0.31765974,17.559999,-0.193979368,10.08325111,98",
"143.54396,45.081081,0.31071013,17.549999,-0.155206823,12.53082484,139",
"143.54396,45.090092,0.31071013,17.549999,-0.131017029,10.63817836,34",
"143.54396,45.099098,0.31765974,17.559999,-0.108587385,8.848440687,99",
"143.55573,45.090092,0.31071013,17.549999,-0.047840542,9.263504595,88",
"143.55573,45.099098,0.3087748,17.27,-0.023265932,7.804939491,55",
"143.62637,45.99099,1.3630033,16.914999,-1.934856245,78.74761084,355",
"143.62637,46,1.2884779,16.48,-1.970835064,80.18900243,122",
"143.63815,45.99099,1.3170884,16.775,-1.819977312,77.6490156,37",
"143.63815,46,1.3040049,16.41,-1.855416002,79.06850288,196",
"143.64992,45.99099,1.3170884,16.775,-1.70364135,76.00969278,289",
"143.64992,46,1.3170884,16.775,-1.737240088,77.35617509,97",
"143.81476,45.054054,0.47257063,17.975,1.567993492,15.51586686,175",
"143.81476,45.063065,0.47257063,17.975,1.616452127,17.26297521,24",
"143.81476,45.072071,0.4959102,17.92,1.663369874,18.90684665,27",
"143.82654,45.045044,0.47367984,18.065001,1.584466852,15.25328499,68",
"143.82654,45.054054,0.47367984,18.065001,1.634199946,17.10614021,77",
"143.82654,45.063065,0.47257063,17.975,1.68261326,18.88421557,43",
"143.82654,45.072071,0.4959102,17.92,1.729482292,20.55258129,97"
), class = "factor")), .Names = "x.y.chla.sst.ssha.eke.tuna", row.names = c(NA,
100L), class = "data.frame")
答案 0 :(得分:0)
您的data1数据框已经搞乱了。看看str()给你的是什么:
> str(data1)
'data.frame': 100 obs. of 1 variable:
$ x.y.chla.sst.ssha.eke.tuna: Factor w/ 311 levels "140.01178,44.666668,0.21406905,19.939999,6.931947586,213.8725429,87",..: 3 2 1 6 5 4 9 8 7 12 ...
当你实际上是一个包含单列的数据框时,你可能会认为这是一个带有numericcolumns的数据框。你似乎没有使用正确的'sep'参数就使用了read.table。列名全部组合在一起,值被捆绑在一起作为单个因子串。真糟糕!
最好是回到开始并重做read.table
努力。我想可以解析单列的名称,然后在发送因子列的as.character()结果上使用read.table,但这似乎是巴洛克式的。
编辑评论:我也认为大多数人选择AUC工具真的不明白它提供什么。它似乎比它应得的使用频率更高。