Dropping variables in R using values from another data frame

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

Dropping variables in R using values from another data frame



I am conducting a multidimensional item response theory analysis using (mirt) package.


df.mirt <- mirt(data = df, model = 1, itemtype = "gpcm")



after that, I used the summary function to get the loading for each item


summary.df <- summary(df.mirt)



The summary results showed that I have items with really bad loading. Now, I would like to drop these items from my df without the need to drop each item one-by-one by using the loading values from the summary function.



The loading values are stored in summary.df$rotF, the criteria is to drop any item with loading less than the absolute value of 0.4, this is what I tried:


summary.df$rotF


New.df <- SelectVar[, summary.df$rotF > abs(0.4)]



Another one:


df2 <- if (summary.df$rofF < abs(0.4), SelectVar)
My.vars <- names(df.mirt) %in% names(df2)
New.df <- df.mirt[!My.vars]



Clearly, it is a beginner question, but I am still learning R. I do appreciate your help.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

Trying to Print Gridster Items to PDF without overlapping contents

Hystrix command on request collapser fallback