[R] Questions about sort data

Gabor Grothendieck ggrothendieck at gmail.com
Mon Sep 4 17:32:41 CEST 2006


Regarding your other questions
On 9/4/06, Xiao Zhao <Xiao.Zhao at newcastle.ac.uk> wrote:
> Dear R users,
> I am doing my project which I want to plot a piecewise function, I knew
> that I can use the command segments to plot. But the problem is I want
> to use my real data which needs me to sort of my data by using the 'if
> else'command, I use it
> If(t[i]<36) lambda<-0.5
> Else lambda<-0.2
> The funny thing is when I look at my data set, it did not follow my
> command to sort data, also the final numbers do not change either.
> The other problem is I have a big data set, sometimes I want to know the
> number of some data, such as how many numbers are over 60, how to do
> this by using R?
> Does anybody got any ideas about my two pros?


Using the built in data set rivers there are

  sum(rivers > 1000)

rivers greater than 1000 miles long.

See the last two lines on every message to r-help.



More information about the R-help mailing list