[top] [TitleIndex] [WordIndex]

11/480a/5-18

23. Statistics: RPy2 from Sage

  1. Last homework assignment
  2. Questions
  3. Lecture: http://flask.sagenb.org/home/pub/57/

wstein@sage:~$ sage -R

R version 2.10.1 (2009-12-14)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> 2 + 3
[1] 5
> 2 + 3
[1] 5
> c(1,2,4,8,9,10,10,10)
[1]  1  2  4  8  9 10 10 10
> v = c(1,2,4,8,9,10,10,10)
> 
> v+v
[1]  2  4  8 16 18 20 20 20
> c(v,v)
 [1]  1  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10
> c(v,v,v)
 [1]  1  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10
> c(v,v,v,v)
 [1]  1  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10  1
[26]  2  4  8  9 10 10 10
> c(v,v,v,v,v)
 [1]  1  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10  1
[26]  2  4  8  9 10 10 10  1  2  4  8  9 10 10 10
> pi
[1] 3.141593
> v = pi
> w = v + 1; w
[1] 4.141593
> w = c(v, 1); w
[1] 3.141593 1.000000
> w[1]
[1] 3.141593
> w[2]
[1] 1
> letters
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"
> sum( c(1,NA,2,3), na.rm=TRUE )
[1] 6
> sum( c(1,NA,2,3), na.rm=FALSE )
[1] NA


2013-05-11 18:32