0

I loop this case : naked_FINAL$V2 which is a float :

-0.182231972057    -0.0394883040297   -0.175151743984    -1.0               0.00382017030833   -0.138775422474   -0.136759608005    -0.00931498957763  0.0467232056437    -0.177560317462    -0.0462697502318   -0.114731438657   
 -0.133543749187    -0.0796649609804   -1.0               -0.0871896849893   -0.0671498062617   -1.0     -0.091948159794    -0.0902651789613   -0.157156204337    -0.0847245799066   -0.0981150527055   -0.0673055244922 

i want to selection only float that are > 0.05 :

for (i in unique(naked_FINAL$V2)) {   
    high_prion_naked <- naked_FINAL$V2[which(naked_FINAL$V2 < 0.05)]
}

When I do this in my R console I get warning message :

There were 50 or more warnings (use warnings() to see the first 50)

> warnings()
Warning messages:
1: In Ops.factor(naked_FINAL$V2, 0.05) : ‘>’ not meaningful for factors
2: In Ops.factor(naked_FINAL$V2, 0.05) : ‘>’ not meaningful for factors

What can I do all it's all correct?

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197
James Jd
  • 7
  • 4
  • 2
    Can you show `str(naked_FINAL)`? – Roman Luštrik May 04 '17 at 13:54
  • 4
    I bet `class(naked_FINAL$V2)` isn't numeric, it's a factor. This means there's probably some non-numeric value in that column and your data import didn't work well. When asking for help, be sure to include a [reproduicble example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) so we can verify such things. Also, what's the point of the loop if you never use `i`? – MrFlick May 04 '17 at 13:54
  • I agree with the others, in addition the `i` is nowhere to be found inside the `for` loop so `high_prion_naked <- naked_FINAL$V2[which(naked_FINAL$V2 < 0.05)]` should return the same result – Niek May 04 '17 at 14:08

0 Answers0