remove rown and column in r which has infinity value code example Example: r remove inf values df <- df[!is.infinite(rowSums(df)),]