R にベクトル/リスト/配列などにオブジェクトを配置する機能があるかどうかに興味があります。randomforest パッケージを使用して、より大きなデータのサブセットを処理しており、各バージョンをリストに保存したいと考えています。これは次のようになります。
answers <- c()
for(i in 1:10){
x <- round((1/i), 3)
answers <- (rbind(answers, x))
}
理想的には、次のようなことをしたいと思います。
answers <- c()
for(i in 1:10){
RF <- randomForest(training, training$data1, sampsize=c(100), do.trace=TRUE, importance=TRUE, ntree=50,,forest=TRUE)
answers <- (rbind(answers, RF))
}
この種の作品ですが、単一の RF オブジェクトの出力は次のとおりです。
> RF
Call:
randomForest(x = training, y = training$data1, ntree = 50, sampsize = c(100), importance = TRUE, do.trace = TRUE, forest = TRUE)
Type of random forest: regression
Number of trees: 10
No. of variables tried at each split: 2
Mean of squared residuals: 0.05343956
% Var explained: 14.32
これは「回答」リストの出力ですが、
> answers
call type predicted mse rsq oob.times importance importanceSD
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
RF Expression "regression" Numeric,150000 Numeric,10 Numeric,10 Integer,150000 Numeric,16 Numeric,8
localImportance proximity ntree mtry forest coefs y test inbag
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
RF NULL NULL 10 2 List,11 NULL Integer,150000 NULL NULL
保存された情報が単一の RF オブジェクトと同じになるように、すべての RF オブジェクトを保存する方法またはそれらを呼び出す方法を知っている人はいますか? 提案をありがとう。