On Mon, 2009-08-10 at 14:13 +0000, Inchallah Yarab wrote: > i have a matrice M and i want to extract only rows where GWP_Max is > positif and smaller than 1000 but it is given me this:!!!??? > > M > Policy.Number GWP_Max > 1 4001023 500 > 2 4001025 700 > 3 4001028 600 > 4 4001062 2335.1 > 5 6100001 2000 > 6 1060000006 1400 > 7 1060000009 77.19 > 8 1060000071 18898.88 > 9 1060000073 671.70015 > 10 1060000077 18898.88 > 11 1060000077 18898.88 > 12 1060000124 93541.87 > > M[M[,2]> 0,] > Policy.Number GWP_Max > NA NA <NA> > NA.1 NA <NA> > NA.2 NA <NA> > NA.3 NA <NA> > NA.4 NA <NA> > NA.5 NA <NA> > NA.6 NA <NA> > NA.7 NA <NA> > NA.8 NA <NA> > NA.9 NA <NA> > NA.10 NA <NA> > NA.11 NA <NA> > Warning message: > In Ops.factor(M[, 2], 0) : > not meaningful for factors > > > somebady help me please!!!
Notice the warning: Warning message: In Ops.factor(M[, 2], 0) : > not meaningful for factors So your data are not what you think they are. Look at the output of str(M) and sapply(M, class) and see what types of variables are in M. If they are not numeric then make them numeric. How you do that will depend on where these data originated, how they were read in etc, none of which you have provided information on. HTH G > > thank you a lot > Regards > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.