Skip to content
Prev 392231 / 398502 Next

mice: selecting small subset of variables to impute from dataset with many variables (> 2500)

Maybe this is too simple but could you use the select() function from dplyr?
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Bert Gunter
Sent: Thursday, July 14, 2022 2:10 PM
To: Ian McPhail <ivmcphail at gmail.com>
Cc: R-help <r-help at r-project.org>
Subject: Re: [R] mice: selecting small subset of variables to impute from dataset with many variables (> 2500)

[External Email]

If I understand your query correctly, you can use negative indexing to omit variables. See ?'[' for details.
a b c d
1 1 a 4 e
2 2 b 5 f
3 3 c 6 g
a c
1 1 4
2 2 5
3 3 6

Of course you have to know the numerical index of the columns you wish to omit, but somethingh of the sort seems unavoidable in any case.

Cheers,
Bert
On Thu, Jul 14, 2022 at 11:00 AM Ian McPhail <ivmcphail at gmail.com> wrote:
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=UxEz20f8LSF-iyVuq17UnoNVkEe6HoC3E6vHWssLjSBKtqLSrm7qs8v2ewcXchwc&s=ABj_L_b515lhH7RIgTmmjylyWxJCbRWvzZDkxUkGw90&e=
PLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=UxEz20f8LSF-iyVuq17UnoNVkEe6HoC3E6vHWssLjSBKtqLSrm7qs8v2ewcXchwc&s=LiocKPLYgq5olAT6tqGjr2xOLwDWw55DRzhuq7gcF5A&e=
and provide commented, minimal, self-contained, reproducible code.
Message-ID: <BN6PR2201MB15534DD9DF008530A1704467CF889@BN6PR2201MB1553.namprd22.prod.outlook.com>
In-Reply-To: <CAGxFJbTc2ukmo4JFw_wF1zgj3qRYrgfAjABU8o0ste8rYedNYw@mail.gmail.com>