0

我有两组数据框 A 和 B。数据框 A 有 590 列,B 有 6 个变量。数据集 A 中的每一列都是因变量。数据集 B 中的所有 6 个变量都是自变量。数据集 A 和 B 的数据中都包含 NA。我想在 B 中的 6 个变量上运行 A 中的每一列。然后我将把拟合值放在一个 590 列的矩阵中。我正在运行这些代码;

set.seed(1)
n<-590
fitted2<-matrix(0, nrow = 678, ncol = 590)

fitttedqr2<-function(x)
  {fitted2[,x]<-fitted(rq(Retprice[,x]~ Vix + Eqreturn + Changetbill + 
    Liqsprd + Creditsprd + Bondslope, tau = 0.01 ))
    }

 fittedvalue2<-sapply(1:m, fitttedqr2)

数据 A 中的每一列都对数据 B 中的所有变量进行了回归。B 具有变量 Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslop。请我如何在此函数中包含 na.action=na.exclude 或 ....=na.omit 以处理任何数据列中的 na(s)。

4

0 回答 0