3. Arrays
=========================

- Bioconductor Workshop, S. 7-8,10,20-21
  (siehe auch "An Introduction to R", Sec 5)
   Addenda:
	S. 7: matrix: array with 2 dimensions
        S. 10: 		x <- array( 1:(3*5*10),  c(3,5,10))

			z <- 1:(3*5*10)
                        dim(z) <- c(3,5,10)
			z

			dimnames(z) <- list( c( "zeile1", "zeile2", "zeile3"),
                                             c( letters[1:5]),
                                             paste( "tafel",1:10))

			
	S. 21
			z[1:2,4:5,"tafel 5"]

			x = matrix(1:9, ncol = 3)
			row(x)
			row(x) < col(x)
			x[row(x) < col(x)]

			x[c(3:5,1)]

			help("[")

- "An Introduction to R", Teile aus Sec 5.4, 

			x = matrix(1:9, ncol = 3)
			z = matrix(22:14, nrow = 3)
			3*x + z + 1.5

			y = array(14:3, dim=c(3,4))

			x %*% y

			D <- matrix( c(   1,1,
                                          3,1,
                                          4,3,
                                          2,1,
                                          8,2,
                                          4,7,
                                          13,1,
                                          3,10), ncol=2, byrow = TRUE)

			D <- matrix( c(   1,1,
                                          3,3,
                                          -1,-1,
                                          -3,-3,
                                          -5,-5,
					  5,5
                                          ), ncol=2, byrow = TRUE)

			C <- 1/length(D)/2 * t(D) %*% (D)
			eigen(C)

4. Listen und data frames
=========================
- Bioconductor Workshop, S. 28-36
   Addenda:
	S. 28
		lst = list(a = 1:3, b = "a list")

		lst[["a"]]
		lst[[1]]
		lst[[3]]

		lst2 = list( "another list", 3:1, matrix( 1:4, nrow=2))

- An Introduction to R", S. 29 - 32
		data(women)
		women
		attach( women)
		height
		detach( women)
		height


      Input file form with names and row labels:
          
               Price    Floor     Area   Rooms     Age  Cent.heat
          01   52.00    111.0      830     5       6.2      no
          02   54.75    128.0      710     5       7.5      no
          03   57.50    101.0     1000     5       4.2      no
          04   57.50    131.0      690     6       8.8      no
          05   59.75     93.0      900     5       1.9     yes
          ...

	HousePrice <- read.table("houses.data")


	Input file form without row labels:
          
          Price    Floor     Area   Rooms     Age  Cent.heat
          52.00    111.0      830     5       6.2      no
          54.75    128.0      710     5       7.5      no
          57.50    101.0     1000     5       4.2      no
          57.50    131.0      690     6       8.8      no
          59.75     93.0      900     5       1.9     yes

	HousePrice <- read.table("houses.data", header=TRUE)
		 
5. Kontrollstrukuren
====================

- An Introduction to R", Sec 9
	o R is an expression language: its only command type is a function or 
					expression which returns a result. 
	o grouped expressions:	{expr_1; ...; expr_m}
	o if statements: if (expr_1) expr_2 else expr_3
		where expr_1 must evaluate to a single logical value
	o Repetitive execution: for loops, repeat and while
		for (name in expr_1) expr_2	

		x <- 1:10
		for ( i in 1:10 ) x[i] = i*2

6. Funktionen
=============
- Bioconductor Workshop, S. 49-53

	Addenda
		twosam <- function(y1, y2) {
         		n1  <- length(y1); n2  <- length(y2)
         		yb1 <- mean(y1);   yb2 <- mean(y2)
         		s1  <- var(y1);    s2  <- var(y2)
         		s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2)
         		tst <- (yb1 - yb2)/sqrt(s*(1/n1 + 1/n2))
         		tst
       		}

	Defining new binary operators: %anything%
		"%!%" <- function(X, y) { ... }
