Site hosted by Angelfire.com: Build your free website today!

 

Arithmatic Operations and built-in functions in S-plus:

> prod(x)
[1] 6
> p<-(12/(2+6)**4)-(((6-1)*5)^3)
> p
[1] -15625
> print(p)                                  # [Same command as “p” only]
[1] -15625
> summary(x)
 Min. 1st Qu. Median Mean 3rd Qu. Max.
    1     1.5      2    2     2.5    3
> summary(y)
 Min. 1st Qu. Median Mean 3rd Qu. Max.
    1    1.75    2.5  2.5    3.25    4
> summary (x[x==y])
 Min. 1st Qu. Median Mean 3rd Qu. Max.
    1     1.5      2    2     2.5    3
Warning messages:
  Length of longer object is not a multiple of the length of the shorter object in: x == y
> length(y)
[1] 4
> sum(y)
[1] 10
> max(y)
[1] 4
> min(y)
[1] 1
> mean(y)
[1] 2.5
> sqrt(y)
[1] 1.000000 1.414214 1.732051 2.000000
> e_sqrt(y)
> sort(e)
[1] 1.000000 1.414214 1.732051 2.000000
> mode(e)
[1] "numeric"
> mode(p)
[1] "numeric"
> rr<-numeric()
> rr
numeric(0)
> mode(rr)
[1] "numeric"
> f<-c(8,-3,6,2,-6,3,-9,2,-6,2)
> abs(f)
 [1] 8 3 6 2 6 3 9 2 6 2
> sort(f)
 [1] -9 -6 -6 -3  2  2  2  3  6  8
> order(f,x)
 [1]  7  5  9  2  4 10  8  6  3  1
> sin(f)
 [1]  0.9893582 -0.1411200 -0.2794155  0.9092974  0.2794155  0.1411200 -0.4121185  0.9092974  0.2794155
[10]  0.9092974
> floor(sin(f))                            # [ Look ! I’m sick of instructing about all the commands, just gimme a break!! Why don’t you try “help(floor)” to know what its functionality is; would you ? Same goes for the rest of the Document :p]
 [1]  0 -1 -1  0  0  0 -1  0  0  0
> trunc(sin(f))
 [1] 0 0 0 0 0 0 0 0 0 0
> ceiling(sin(f))
 [1] 1 0 0 1 1 1 0 1 1 1
> round(sin(f))
 [1] 1 0 0 1 0 0 0 1 0 1
> quantile(x,seq(.1,.9,.1))
 10% 20% 30% 40%  50%  60%  70%  80%  90%
 2.9 4.8 6.7 8.6 10.5 12.4 14.3 16.2 18.1
> quantile(x,.77)
   77%
 15.63
> quantile(x,c(.25,.75))
  25%   75%
 5.75 15.25

Back to Index page