我在Windows 8计算机上遇到随机林和Rstudio的错误:
Error in eval(expr, envir, enclos) :
..6 used in an incorrect context, no ... to look in
我做错了什么? filtered.featuresTrain是一个包含12行和104列的数据帧。并非所有列都已命名。可能是问题吗? (我只包含12行,因为dput的大小对于发布来说太大了。)
感谢您的帮助! 这是我的代码:数据集在最后
library(randomForest)
rfModel<-randomForest(nextCloseUp ~ .,
data=filtered.featuresTrain,
importance=TRUE,
ntrees=1000)
filtered.featuresTrain<-structure(list(timeFrm530 = c(0.224674434407149, 0.224919475352603,
1.54809974064694, -1.53994709412267, -1.53937533191661, 1.10584167425994,
-1.09936347419627, 0.66558477559415), Open = c(-0.23650815144073,
1.76753353660581, -0.129223557646904, 0.0294297901292079, 0.141124881871024,
0.469847649492199, 0.243429936103452, -0.916765369153886), Close = c(-0.983308940314238,
0.844884447945988, 0.0904210151849578, 0.241285179827179, -0.501826086857636,
-0.233687804413325, 0.193213912019013, -1.54400559905299), mf.mom2 = c(-2.05638961120546,
-0.335332098455595, 0.06955069709805, 0.322628313822541, -0.0945901697340803,
0.140100733442676, -0.131671707928906, 1.85480431557491), mf.mom15 = c(-1.99971171483689,
-0.0508024642916049, 0.336652691680044, 0.516879185572446, -0.352878038329579,
0.143563774930029, 0.993949607260017, -0.0394691581066369), tt.cmo2 = c(-0.421400702504404,
-1.3571166976762, -1.18027954816672, 0.000180726579406562, 0.92209980502853,
-1.34335219909733, 0.827031823762806, -1.17425496486506), tt.cmo15 = c(1.4860473625975,
0.755359545740301, -0.210415084975357, -0.0170674307599795, -2.34415294340412,
0.0195188834324903, -1.71418023544066, 0.0279637372331411), mf.cmo2 = c(-1.34481395016287,
-0.15803359882511, 0.548973573057636, 1.48627950210788, -1.34481395016287,
1.48627950210788, -1.34481395016287, 1.48627950210788), mf.cmo5 = c(-1.63841846499336,
0.0298075291096364, -0.182752834556507, 1.73519186879717, -1.73769070623873,
-0.0998859266540854, -1.72147747077378, -0.177725975247241),
close.dpo2 = c(0.194234393291184, 0.160714037002162, 0.12719368071314,
1.5685690011411, -0.241530238466106, -0.677294870223397,
-0.375611663622195, -0.610254157645352), mf.dpo5 = c(-2.50551045510556,
-0.477652444355615, 0.211581249037692, 1.30824761413805,
1.0850532722906, -0.133158456813267, 0.899970378605958, 0.00711540442548995
), open.vhf5 = c(0.788198348723962, 0.279514680045794, -1.03636625570673,
1.38409588736396, -2.02724309416049, 0.472712041454781, -1.27125021966751,
1.11700135985881), high.vhf5 = c(1.51503744325193, 0.875786739576862,
-1.87907938816571, -0.49403619686972, -0.256600221218979,
1.71935001682363, -0.278185309914501, 1.65419405901793),
low.vhf5 = c(0.606567320646889, 0.27899906368528, -1.30687225727789,
0.324762276054917, -1.43254507893912, -0.216075688313515,
-1.32714206722325, 1.83494828425292), close.vhf5 = c(0.00809863167815033,
0.738370621152307, -2.13600213035988, -0.755535921022773,
-0.863386288472583, 0.212366865747498, -0.507933056207066,
0.793335967832488), close.vhf15 = c(0.206000923445402, 0.0161723400069615,
-0.12326927030503, 0.218334862451178, -0.0816105733429175,
-0.641624581736473, -0.480685583741349, 1.07973707037314),
tt.vhf2 = c(-0.0915109040847571, -1.23635177186475, 1.06363979461145,
0.322963675672215, 1.04554620239286, -1.87346249092754, -0.974925525425236,
1.05947792468514), tt.vhf5 = c(-0.29429469100798, 0.0135133198980897,
0.0370428673996712, 0.178220125075126, 0.581818939298538,
-0.278533318862833, -2.11783794029137, -0.464271590195528
), tt.vhf15 = c(-0.210169527248644, 0.654940071610842, 0.276071569088073,
-2.26513764008168, -1.12473943693501, 0.0717837770633359,
-1.47222058388025, -1.93874924585721), mf.vhf2 = c(1.45113547405232,
0.27287447415033, -0.641611870019321, 0.804744226114098,
-0.676183160445367, 1.0014169836589, -1.28579619544549, -0.938768381308914
), mf.vhf5 = c(1.16370797009611, 0.129172893543382, 0.256795846795394,
-1.70159214848678, -1.90717966212498, -0.0202482457913699,
-1.88850022991147, -0.109928551387138), mf.vhf15 = c(1.38089135578852,
-0.542228691326658, -0.393460442676206, 0.00133986810487571,
-0.0946176420288984, 1.27619328723513, -0.874037620593814,
-0.00219533653780923), vwap.vhf2 = c(1.5927816842377, -0.992171315904916,
1.73045452743842, -1.84295509463441, -1.04273824481426, -1.81037523693765,
1.40720220067016, -0.187562188539679), vwap.vhf5 = c(0.915282232633586,
0.405033816821942, -2.10072510244468, 0.281181238939855,
-1.57657461476171, 0.415816645838365, -0.32308666583342,
1.72250642624602), open.tdi2 = c(-0.315841123823867, 1.43235531118978,
-1.53628014449378, -0.480765315806287, -0.480765315806287,
-1.14046208373597, -0.876583376564095, 1.36638563439682),
open.tdi5.di = c(-0.667926716994546, -0.16727782896447, 1.1708201081341,
-0.576899646443623, 1.27094988574011, -1.72384073538525,
0.661068513048929, -1.40524598845702), high.tdi2 = c(0.0669727683535374,
0.929163277177433, -0.560074874427478, -0.24655105303697,
0.341306112070231, 0.223734679048791, -0.285741530710784,
1.75216330832752), high.tdi15 = c(1.46538623555154, -0.261290403255357,
-1.94613638324863, -1.29078939516849, -2.17852893221321,
-1.62311074018785, -0.563400716909322, 0.261592831914968),
low.tdi5 = c(1.0964231456028, -1.41164218128531, 0.64782609526509,
-0.769332768301767, 1.0964231456028, 1.12700930812583, 0.963883108003022,
1.84068643366309), close.tdi2 = c(-0.451212175005982, 0.473608768300338,
-0.385153536198388, -0.120918980968011, 0.176344893666163,
-3.42385092134772, -0.186977619775605, -2.00359018698445),
volume.tdi15 = c(-0.834673400968402, -0.46338599810796, -0.505581383583633,
-0.662090989972685, 0.340585114179789, -0.0691273292288444,
1.06333996873233, -0.807244385814289), tt.tdi2 = c(-0.751247320976363,
-0.788362402811116, -0.302380206229499, -1.18278906348621,
-0.795073290488625, 1.07045611316483, -0.578500401624748,
-0.714123767897715), tt.tdi5 = c(0.510545684705378, -0.2662044381748,
-1.58259415044232, -0.533552060106212, -0.245785295848903,
1.84655551372837, 0.34833433947756, 0.79295013614514), tt.tdi15.di = c(-0.476006862010526,
-1.1133181641398, -0.755510298416227, 0.664568155870723,
-1.96205768705919, -1.28448189632736, 0.181527709377501,
0.572121167847565), mf.tdi2 = c(0.96988341869122, 0.292389900605064,
-0.695916342900968, -0.672767890825554, -0.733495223595247,
-0.795086209622224, -0.657188398786359, -0.302190499474078
), mf.tdi2.di = c(-1.28954488385787, 0.593699740696282, 0.179905672820657,
0.225041904809748, -0.0127870364420314, 2.10889226384525,
-0.0347325905460211, 1.57674091084821), mf.tdi5 = c(1.54389034605627,
-0.382396471390685, -0.355605949484799, -0.931738894573063,
-1.03405044030251, 1.93376266636652, -0.112177723791531,
1.78885768200258), mf.tdi5.di = c(-1.30223698830312, -0.397372328827734,
0.643661311884573, 1.12638821152572, -0.358609542188232,
-1.98519616952129, -0.503932015148023, -1.9163356823264),
mf.tdi15 = c(0.145670282832994, 1.00531143959764, 1.09056771058365,
-0.414956356529156, 1.02798482748921, -0.871224558588526,
0.878501814943462, 0.788897818205332), mf.tdi15.di = c(-1.01043705627234,
2.23679793499544, 2.19364611000635, 0.165563108254822, 1.98140598401159,
0.420388258357574, 0.423781163019564, -1.65538501566023),
high.trix15.signal = c(0.997324617212161, -2.15672115386542,
-2.05282452170979, 0.382470275777861, -1.98426752818353,
-1.4967677313021, 0.871748910191597, -0.158773235567675),
tt.trix2 = c(-0.0326060893045029, -0.170758062933854, -0.605149128919836,
-0.541557621729311, -0.335127646648025, -0.552722821746583,
-0.391633249956093, -0.422843974490825), tt.trix5.signal = c(0.763344414784495,
-0.186666751168103, -0.587720386363825, -0.283508309281935,
-0.910180171638591, 1.21853190975493, -0.846326865645486,
1.2255549680926), tt.trix15 = c(-0.511548308433596, -0.40695559048579,
-0.915382107332508, -0.27717276389831, -1.14009527833519,
0.0247327384430032, 0.447036139189392, 0.884333809318578),
tt.trix15.signal = c(-1.09376164726848, 0.391786712814538,
-0.0455678339873876, -0.371272454628203, -0.230525430017126,
-0.438217609463516, 0.918708367683858, 0.00173078756013531
), mf.trix2 = c(0.373022968995251, -0.0394696798308571, -0.0885766148397267,
-0.16387244883877, -0.152253660980398, -0.0712652567286631,
0.148791946735244, -0.0552324613711915), mf.trix5 = c(-1.92057628392235,
-2.16847656951292, 0.00711463339999185, -0.0350515234757518,
-0.0333307034672486, 0.0411764885002489, -0.0940307391050801,
0.0739292089342795), mf.trix5.signal = c(-1.68955148457797,
-1.84913514036781, -0.425416274548131, -0.0616481751419279,
-0.310287887065941, -0.21075079504619, -1.30862419236738,
0.228835020235374), mf.trix15 = c(-0.104855627314215, -0.10281374646514,
-0.105415447420059, -0.116503436785869, -0.105936042337377,
-0.089676533641166, -0.102213017893501, 0.1792786808323),
mf.trix15.signal = c(-0.408266442420968, -0.0654374815493358,
-0.188824233348262, -0.421838537694179, -0.22076326998236,
-0.32200128404919, -0.387760964198656, -0.46668456256933),
open.obv = c(-0.195392970811658, -1.1808156124573, -1.17954237846941,
-0.226421420420902, -1.21445892486146, -1.50024072919543,
-0.517166309673038, -0.785305224360805), close.obv = c(-0.828482196640514,
-0.627621891988222, -0.62876696786499, 1.82838177791276,
-0.660168968874809, -0.879389265913234, 0.599924854418016,
1.64773970672493), mfi15 = c(-0.975275135464762, 1.19474333827621,
1.38636895674888, 0.143050370958495, 1.19249074538744, -0.771311642183764,
0.700232383905865, -1.59247772232607), cmf2 = c(-0.441166726999715,
0.49846847486954, 0.514430643247309, 1.11578826509515, -1.73030085675432,
-0.581595294288582, 0.777453505669784, 1.47272681792733),
cmf5 = c(-1.05393753559937, 0.759247231446599, 0.47647333069352,
1.00207415056846, -0.385059671923552, -1.12601644162313,
-0.0939213999680846, -0.832952601247515), chaVol15 = c(-0.445884188542412,
-0.223745484481669, -0.691289255304907, 0.321894500288325,
-0.926053950260577, 0.779456600109239, -0.836245683347235,
3.36196225360165), adx2.DIn = c(1.50206326416558, -0.364650676621631,
-0.15931024678911, -0.451863917128836, -0.809630976127603,
0.36742753868974, -0.0718172286919587, 1.16710642173826),
adx2.DX = c(1.01283653659164, 0.207917419818041, -0.9670423795233,
-0.0152661658711954, -0.9670423795233, -0.716925159975696,
-0.756584036039179, 0.995022210126294), adx5.DX = c(0.970779068408866,
-0.602886136589029, -0.77559818735579, -1.57780309237756,
-0.77559818735579, 0.632853529059265, -0.494739130643764,
1.34104792443216), adx5.ADX = c(0.550731486540498, -0.970867256136779,
-1.08769503168992, -0.64795154261427, -1.11892595408631,
0.500125747654511, -0.619968815098982, 0.68722873187513),
adx15.DX = c(-0.467633192840039, -1.79347124395138, -1.69198540471558,
-0.843792366221204, -1.69198540471559, 0.522613511521497,
0.646012206871164, 1.34913043589239), adx15.ADX = c(-0.305172590480671,
-0.208452532372414, -0.660230295494471, -0.208755240290099,
-0.803495739748568, -0.429393579361691, 1.275533197997, 0.266548814417682
), aroonUp2 = c(-1.31384719821183, 0.990317257511016, 0.990317257511016,
-1.31384719821183, 0.990317257511016, -1.31384719821183,
0.990317257511016, -1.31384719821183), aroonDn2 = c(1.18624105743818,
-1.13069799789258, 0.0277715297728003, -1.13069799789258,
1.18624105743818, -1.13069799789258, 0.0277715297728003,
1.18624105743818), aroonUp5 = c(-1.57747656915908, 1.02785803601316,
-0.535342727090186, -0.0142758060557382, 1.02785803601316,
-1.05640964812463, -1.57747656915908, -1.05640964812463),
aroonDn5 = c(1.3912025781585, -0.161273165111368, -1.19625699395795,
-0.678765079534657, -1.19625699395795, 0.356218749311922,
-1.19625699395795, 1.3912025781585), aroonUp15 = c(-0.888074360843717,
1.02712293137464, 0.452563743709133, -1.07959409006555, 1.02712293137464,
-0.121995443956375, 0.0695242852654613, -1.65415327773106
), aroonDn15 = c(1.65384471420531, -0.412335457722912, -0.975839140976065,
0.902506469867778, -1.16367370206045, 1.27817559203655, -1.16367370206045,
1.65384471420531), vwap.macd2 = c(-0.0181917060936888, -0.0476420100146404,
-0.0818673274026294, 0.167526700073282, -0.336281672950012,
-0.0640648122123276, -0.00959189541013099, -0.0523198186130361
), vwap.macd5 = c(0.13814046062469, 0.140133695882335, 0.0603477437278619,
-0.0585942703900586, 0.00215132011192154, 0.067635721883368,
0.200395250618871, 0.0833027278305769), vwap.macd5.signal = c(0.517981647671292,
-0.319603870548703, 0.0218661425615135, 0.0937422470905803,
0.0165111331890874, 0.18397407209877, 0.116076331368418,
0.189044374313762), vwap.macd12 = c(0.0432146756688873, -0.213077300259202,
-0.172466159112148, 0.0298945124658526, -0.153139286328208,
-0.0393954915503638, -0.0708927859988774, -0.0160220273633807
), vwap.macd12.signal = c(-0.190135449213133, -0.419326931511124,
-0.471925009616942, 0.0803722732732785, -0.467911281678916,
-0.268093774095073, -0.460063917242243, 0.0201873820142991
), MF = c(-0.0419878107593138, -0.151093692306838, -0.104901681090999,
0.00626612716469386, -0.0222495169968085, -0.141904898379168,
-0.0835697590393931, -0.132947000095979), MF.1 = c(0.165760405696766,
-0.244068908072638, -0.151897956858666, 0.114681352354225,
-0.0513100889417883, -0.138305473805497, -0.0272154888688059,
-0.122330456557719), MF.2 = c(0.697358079074279, -0.0720046924573997,
-0.117453537942411, -0.130659450646448, -0.204420404739976,
-0.0134850436016703, -0.721658065461852, 0.023780978818936
), MF.3 = c(0.33289422375251, 0.0458704807995176, 0.0722346207325015,
0.132426494435252, 0.059754186373043, 0.077593743595434,
-0.1546775100792, 0.0838851556403757), MF.4 = c(5.3744019588765,
-0.0728885925826273, -0.0732837587576414, -0.079026209168195,
-0.0731864491190972, -0.0734182772978063, -0.0720941200186179,
-0.0727353120766663), ..6 = c(0.0205094233778095, 1.08586506237838,
-0.699319412660316, -0.26198641144016, -0.463708690500279,
-0.571593037234264, -0.208018079794928, -0.0554814374851246
), ..7 = c(0.266492442729569, 0.137047588592766, -0.257589972456207,
-0.141517318605536, -0.1832589778944, -0.0774032117187774,
-0.746100396981415, 0.22238879157022), ..10 = c(0.265600804583191,
-0.0741671332725318, 1.23136520547269, -0.272533897849763,
-0.609846900171338, 0.246088952565616, -1.41432309065027,
0.265457837745146), ..11 = c(0.375551255580607, 0.178535992375736,
0.21723289046491, 0.146665585083775, -0.0100973476503172,
0.313164019086684, -0.705074791949805, 0.207302982031722),
VWAP.ch = c(0.0576565668001534, 0.0193240101831763, 10.6069118644083,
0.0110729215965136, -0.0175960980163419, 0.0106814409765161,
0.146045326125412, 0.031188914298853), VWAP.ch.2 = c(0.199597816318469,
0.0574583739722574, 0.11488553766734, 0.0116280238056513,
-0.0131625974323338, 0.0115013870816895, 0.0781854097988134,
0.10246118007192), VWAP.ch.3 = c(0.383456916946862, 0.102659804056927,
0.0811931030096908, 0.0355928140774328, 0.0232293141249417,
0.0354851844483748, 0.0981355358548848, 0.136504175674884
), VWAP.ch.4 = c(-0.641085504511695, -0.783486775573109,
-0.747643268109362, -0.115145603821469, 0.0245168880474113,
-0.0597503159071457, -0.0100135640464251, 0.153201026721511
), ..6.2 = c(0.0541592860183951, 0.0856586811191674, 0.036422379874053,
0.0571442044810226, 0.0563107925442871, 0.0458569108141821,
0.00153532565348782, 0.0562990259346424), ..7.2 = c(0.0233931813576839,
0.0787466984205763, -0.135837715633031, -0.200819298414742,
-0.101233571193718, -0.061263056469757, -0.116723850032097,
0.0412372847462216), ..8.2 = c(0.0583924417694487, 0.0650498391753187,
-0.0637799249425176, -0.177400015694601, -0.0560010104333784,
0.0353511529403027, -0.0563651847386874, 0.0171768463993938
), ..10.2 = c(0.0769468587289935, 0.00584519560153613, 0.111210958992151,
-0.109230225554784, -0.0342842776387116, 0.0605480880911766,
-0.0699348919650817, 0.0758842242101409), ..12.2 = c(-0.209107338750225,
-0.541706256317261, -0.583021826393438, -0.105724097728188,
-0.0763861150624977, -8.94789778112101, -0.000979129985664709,
0.23129192482033), ..6.4 = c(0.924236989440541, 0.746906785497348,
-1.56034824660371, -1.32269077630208, -0.953834796323951,
-0.803090174824842, 0.493183002309111, 0.132073110798157),
..7.4 = c(1.32032028542343, 1.26352447128838, -1.45339665799587,
-1.05500647829659, -0.803225072519086, 0.300048191882921,
-0.841763029646635, 0.925745281679129), ..10.4 = c(0.668894349745558,
0.750153688190792, -0.105944570719598, -0.431029191766027,
-0.770784425355405, 1.48957621102388, -1.50348962580204,
0.88053364383319), MF.TT.ratio = c(0.371435912056623, -0.236691145446921,
0.179987345237384, 0.583783173991398, -0.0770965423191162,
-0.190017865759247, 0.16646693267708, 0.269315606339563),
MF.TT.ratio.2 = c(-0.126651236025501, -0.00365444839370629,
0.0782400924322203, -0.141298328783191, 0.0162554187801607,
0.00103313484552139, 0.0548441435825374, 0.247184612080313
), MF.TT.ratio.3 = c(-0.0879805582977273, -0.0318018540905529,
1.01030380926967, -0.09719373059152, 0.0470401923315216,
-0.0277386777814398, -0.624485962760752, 0.10950763820697
), MF.TT.ratio.4 = c(-0.17088688637523, -0.0737457463194894,
0.698667740663754, -0.161825566656007, 0.00458278122269956,
-0.111424326278916, -0.272755668370546, 0.117250475015145
), ..8.5 = c(-0.000561034236154927, 0.0655130285681371, 0.771139516944708,
0.00539369802478528, 0.238296863089703, 0.0839433031989407,
-0.422361060921539, 0.103986948256721), ..9.5 = c(-0.105660877029805,
0.017150387236586, 0.504826743560601, -0.0864996082031562,
0.129632138786316, 0.367828088970599, -0.219911397161518,
0.0488841272999117), ..10.5 = c(-0.34729371210138, -0.113836303879758,
-0.0099115643240741, -0.168641547760545, 0.0316546712708052,
0.0536241675724434, 0.118778697174669, 0.203369030334841),
MF.TT.ratio.6 = c(0.108999302654624, 0.0877594365659816,
0.183990188861028, 0.193191011590134, 0.0739643680092707,
0.0609129058098376, 0.0893744794374625, 0.146625681591971
), ..24.5 = c(-0.365778139230962, -0.256841825690719, 0.201844539196721,
-0.246053776542254, 0.275416993768678, 0.461972066322042,
-0.790396377732572, -0.0622408340254435), nextCloseUp = c(1L,
1L, 1L, 1L, 3L, 3L, 3L, 3L)), .Names = c("timeFrm530", "Open",
"Close", "mf.mom2", "mf.mom15", "tt.cmo2", "tt.cmo15", "mf.cmo2",
"mf.cmo5", "close.dpo2", "mf.dpo5", "open.vhf5", "high.vhf5",
"low.vhf5", "close.vhf5", "close.vhf15", "tt.vhf2", "tt.vhf5",
"tt.vhf15", "mf.vhf2", "mf.vhf5", "mf.vhf15", "vwap.vhf2", "vwap.vhf5",
"open.tdi2", "open.tdi5.di", "high.tdi2", "high.tdi15", "low.tdi5",
"close.tdi2", "volume.tdi15", "tt.tdi2", "tt.tdi5", "tt.tdi15.di",
"mf.tdi2", "mf.tdi2.di", "mf.tdi5", "mf.tdi5.di", "mf.tdi15",
"mf.tdi15.di", "high.trix15.signal", "tt.trix2", "tt.trix5.signal",
"tt.trix15", "tt.trix15.signal", "mf.trix2", "mf.trix5", "mf.trix5.signal",
"mf.trix15", "mf.trix15.signal", "open.obv", "close.obv", "mfi15",
"cmf2", "cmf5", "chaVol15", "adx2.DIn", "adx2.DX", "adx5.DX",
"adx5.ADX", "adx15.DX", "adx15.ADX", "aroonUp2", "aroonDn2",
"aroonUp5", "aroonDn5", "aroonUp15", "aroonDn15", "vwap.macd2",
"vwap.macd5", "vwap.macd5.signal", "vwap.macd12", "vwap.macd12.signal",
"MF", "MF.1", "MF.2", "MF.3", "MF.4", "..6", "..7", "..10", "..11",
"VWAP.ch", "VWAP.ch.2", "VWAP.ch.3", "VWAP.ch.4", "..6.2", "..7.2",
"..8.2", "..10.2", "..12.2", "..6.4", "..7.4", "..10.4", "MF.TT.ratio",
"MF.TT.ratio.2", "MF.TT.ratio.3", "MF.TT.ratio.4", "..8.5", "..9.5",
"..10.5", "MF.TT.ratio.6", "..24.5", "nextCloseUp"), row.names = c("2014-05-14 13:59:53",
"2014-05-19 13:59:59", "2014-05-19 22:59:58", "2014-06-12 01:59:45",
"2014-05-20 01:59:59", "2014-05-20 19:59:29", "2014-05-30 04:59:33",
"2014-06-12 16:59:49"), class = "data.frame")
答案 0 :(得分:2)
您似乎有一些不寻常的列名,如
..6, ..12.2, ..6.2, etc
虽然技术上有效但似乎randomForest()
不喜欢它们。最简单的方法是重新命名以双周期开头的列。在这里,我用“V”替换它们。
names(filtered.featuresTrain)<-gsub("^\\.\\.", "V.",
names(filtered.featuresTrain))
这至少应该消除eval()