How to remove rows with inf from a dataframe in R

后端 未结 6 613
自闭症患者
自闭症患者 2020-12-29 03:50

I have a very large dataframe(df) with approximately 35-45 columns(variables) and rows greater than 300. Some of the rows contains NA,NaN,Inf,-Inf values in

6条回答
  •  温柔的废话
    2020-12-29 04:10

    I had this problem and none of the above solutions worked for me. I used the following to remove rows with +/-Inf in columns 15 and 16 of my dataframe.

    d<-subset(c, c[,15:16]!="-Inf") 
    e<-subset(d, d[,15:16]!="Inf")
    

提交回复
热议问题