简体   繁体   English

如何在R中的小鼠多次插补后提取类mids数据中的特定列?

[英]how to extract specific column in class mids data after multiple imputation by mice in R?

I have 20% missing values in my dataset for some variables.对于某些变量,我的数据集中有 20% 的缺失值。 after using the mice package in R (with m=5), I got 5 MI datasets as class mids data.在 R 中使用 mouse 包(m=5)后,我得到了 5 个 MI 数据集作为类 mids 数据。 I want to do further analysis (reduced rank regression which refers rrr form here) by using the MI datasets.我想通过使用 MI 数据集做进一步的分析(减少等级回归,这里指的是 rrr 形式)。 how do I extract specific columns from the MI datasets as the response variable and predictors in my rrr model?如何从 MI 数据集中提取特定列作为我的 rrr 模型中的响应变量和预测变量?

It looks like the rrr package requires two dataframes, one for of the predictor variables and one of the response variables.看起来 rrr 包需要两个数据帧,一个用于预测变量,一个用于响应变量。

https://cran.r-project.org/web/packages/rrr/rrr.pdf https://cran.r-project.org/web/packages/rrr/rrr.pdf

You can use dplyr::select to select the column names you want to keep in both.您可以使用 dplyr::select 来选择要保留在两者中的列名。 If you are new to R, start with install.packages("dplyr") and library(dplyr).如果您是 R 新手,请从 install.packages("dplyr") 和 library(dplyr) 开始。

Let me know if this works.让我知道这个是否奏效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM