🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

R extension failed on column selection

User: "wanglu2014"
New Altair Community Member
Updated by Jocelyn

Hi:

My code is

rm_main = function(dat)
{
    #dat<-dat[-which(rowMeans(is.na(dat)) > 0.5), ]
    dat<-dat[ ,-which(rowMeans(is.na(dat)) > 0.5)]
    return(data.frame(dat))
}

 

When run "dat<-dat[-which(rowMeans(is.na(dat)) > 0.5), ]", rapidminer get the wanted dataframe, however, when run "dat<-dat[ ,-which(rowMeans(is.na(dat)) > 0.5)]" is wrong.

It take "which(rowMeans(is.na(dat)) > 0.5)" result as a list, not filter the dataframe.

Could you kindly suggest some idea?

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "SGolbert"
    New Altair Community Member

    The error lies in the R code itself. You are subsetting the columns using row data (porcentange of missing values in a row). That is incorrect.