I have adjacency list in the form of:
1. 3,4
2. 4
3. 1,4
4. 1,2,3
and I want to transform into adjacency matrix using R.
I have tried various commands like transformation of adjacency list to igraph object and then retransformation of igraph to adjacency matrix, but the obtained adjacency matrix is S4 class. I want simple commands to transform adjacency list to adjacency matrix in R.
data
list(c(1L, 3L, 4L, 8L, 14L, 31L, 2L, 29L, 33L, 7L, 11L, 17L,
5L, 6L, 34L), c(2L, 3L, 4L, 8L, 9L, 12L, 13L, 14L, 18L, 22L,
1L, 10L, 33L, 34L), c(2L, 3L, 4L, 8L, 9L, 12L, 13L, 14L, 18L,
20L, 22L, 32L, 1L, 31L, 34L, 24L), c(2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 11L, 12L, 13L, 14L, 18L, 20L, 22L, 1L, 31L, 10L, 28L,
29L), c(4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L, 14L, 18L, 20L,
22L, 32L, 1L, 17L), c(4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L,
14L, 18L, 20L, 22L, 32L, 1L, 17L), c(4L, 5L, 6L, 7L, 8L, 9L,
11L, 12L, 13L, 14L, 18L, 20L, 22L, 32L, 1L, 17L), c(2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L, 14L, 18L, 20L, 22L, 32L, 1L,
31L, 10L, 28L, 29L), c(2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L,
13L, 14L, 18L, 20L, 22L, 32L, 10L, 28L, 29L, 33L, 34L, 15L, 16L,
19L, 21L, 23L, 24L, 30L, 31L, 27L), c(2L, 4L, 8L, 9L, 10L, 14L,
28L, 29L, 33L, 15L, 16L, 19L, 20L, 21L, 23L, 24L, 27L, 30L, 31L,
32L), c(4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L, 14L, 18L, 20L,
22L, 32L, 1L, 17L), c(2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L,
13L, 14L, 18L, 20L, 22L, 32L), c(2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 11L, 12L, 13L, 14L, 18L, 20L, 22L, 32L), c(2L, 3L, 4L, 5L,
6L, 7L, 8L, 9L, 11L, 12L, 13L, 14L, 18L, 20L, 22L, 32L, 1L, 31L,
10L, 28L, 29L, 33L, 15L, 16L, 19L, 21L, 23L, 24L, 27L, 30L),
c(9L, 15L, 16L, 19L, 21L, 23L, 24L, 30L, 31L, 32L, 10L, 14L,
20L, 27L, 28L, 29L), c(9L, 15L, 16L, 19L, 21L, 23L, 24L,
30L, 31L, 32L, 10L, 14L, 20L, 27L, 28L, 29L), c(1L, 7L, 11L,
17L, 5L, 6L), c(2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L,
13L, 14L, 18L, 20L, 22L, 32L, 31L), c(9L, 15L, 16L, 19L,
21L, 23L, 24L, 30L, 31L, 32L, 10L, 14L, 20L, 27L, 28L, 29L
), c(3L, 4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L, 14L, 18L,
20L, 22L, 32L, 31L, 10L, 15L, 16L, 19L, 21L, 23L, 24L, 27L,
28L, 29L, 30L), c(9L, 15L, 16L, 19L, 21L, 23L, 24L, 30L,
31L, 32L, 10L, 14L, 20L, 27L, 28L, 29L), c(2L, 3L, 4L, 5L,
6L, 7L, 8L, 9L, 11L, 12L, 13L, 14L, 18L, 20L, 22L, 32L, 31L
), c(9L, 15L, 16L, 19L, 21L, 23L, 24L, 30L, 31L, 32L, 10L,
14L, 20L, 27L, 28L, 29L), c(24L, 25L, 32L, 3L, 34L, 27L,
33L, 9L, 15L, 16L, 19L, 21L, 23L, 30L, 31L, 10L, 14L, 20L,
28L, 29L), c(24L, 25L, 32L, 34L, 26L, 29L), c(26L, 28L, 30L,
33L, 34L, 32L, 25L, 29L), c(24L, 27L, 33L, 9L, 10L, 14L,
15L, 16L, 19L, 20L, 21L, 23L, 28L, 29L, 30L, 31L, 32L), c(4L,
8L, 9L, 10L, 14L, 28L, 29L, 33L, 26L, 30L, 32L, 15L, 16L,
19L, 20L, 21L, 23L, 24L, 27L, 31L), c(1L, 4L, 8L, 9L, 10L,
14L, 28L, 29L, 33L, 25L, 26L, 15L, 16L, 19L, 20L, 21L, 23L,
24L, 27L, 30L, 31L, 32L), c(26L, 28L, 30L, 33L, 34L, 9L,
15L, 16L, 19L, 21L, 23L, 24L, 31L, 32L, 10L, 14L, 20L, 27L,
29L), c(1L, 3L, 4L, 8L, 14L, 18L, 20L, 22L, 31L, 33L, 34L,
9L, 15L, 16L, 19L, 21L, 23L, 24L, 30L, 32L, 10L, 27L, 28L,
29L), c(3L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L, 14L, 18L,
20L, 22L, 32L, 26L, 28L, 24L, 25L, 15L, 16L, 19L, 21L, 23L,
30L, 31L, 10L, 27L, 29L), c(1L, 2L, 9L, 10L, 14L, 28L, 29L,
33L, 31L, 34L, 26L, 30L, 24L, 27L), c(1L, 3L, 31L, 33L, 34L,
2L, 26L, 30L, 24L, 25L, 9L))
Suppose el is a list of edge list:
el = list(c(3,4),
c(2,4),
c(1,4),
c(1,2,3))
#Get the matrix dimension
dim <- length(el)
m <- sapply(el, function(x) { r<-rep(0,dim); r[unlist(x)]<-1;r})
[,1] [,2] [,3] [,4]
[1,] 0 0 1 1
[2,] 0 1 0 1
[3,] 1 0 0 1
[4,] 1 1 1 0
I have a surface that I have represented as a matrix that has observed values. Some of these values are controls, and form a grid throughout my surface. I extracted JUST the controls, and interpolated/extrapolated in between to create a "control surface". Then, I can subtract the control surface from the observed surface to get the normalized values.
(sub)Question 1: The interpolation looks unnecessarily irregular... is my interpolation method correct? If not, is there a better method?
(main)Question 2: How can I visualize the result as lines poking through the control surface with the ids at the top? I would like something like this:
Code follows (sorry for ugly dput):
library(dplyr)
library(tidyr)
library(akima)
b <- structure(list(Entr = 1:931, Row = c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,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
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L),
Col = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L,
13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L,
37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L,
49L, 49L, 48L, 47L, 46L, 45L, 44L, 43L, 42L, 41L, 40L, 39L,
38L, 37L, 36L, 35L, 34L, 33L, 32L, 31L, 30L, 29L, 28L, 27L,
26L, 25L, 24L, 23L, 22L, 21L, 20L, 19L, 18L, 17L, 16L, 15L,
14L, 13L, 12L, 11L, 10L, 9L, 8L, 7L, 6L, 5L, 4L, 3L, 2L,
1L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L,
26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L,
38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L,
49L, 48L, 47L, 46L, 45L, 44L, 43L, 42L, 41L, 40L, 39L, 38L,
37L, 36L, 35L, 34L, 33L, 32L, 31L, 30L, 29L, 28L, 27L, 26L,
25L, 24L, 23L, 22L, 21L, 20L, 19L, 18L, 17L, 16L, 15L, 14L,
13L, 12L, 11L, 10L, 9L, 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L,
27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L,
39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 49L,
48L, 47L, 46L, 45L, 44L, 43L, 42L, 41L, 40L, 39L, 38L, 37L,
36L, 35L, 34L, 33L, 32L, 31L, 30L, 29L, 28L, 27L, 26L, 25L,
24L, 23L, 22L, 21L, 20L, 19L, 18L, 17L, 16L, 15L, 14L, 13L,
12L, 11L, 10L, 9L, 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,
16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L,
28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L,
40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 49L, 48L,
47L, 46L, 45L, 44L, 43L, 42L, 41L, 40L, 39L, 38L, 37L, 36L,
35L, 34L, 33L, 32L, 31L, 30L, 29L, 28L, 27L, 26L, 25L, 24L,
23L, 22L, 21L, 20L, 19L, 18L, 17L, 16L, 15L, 14L, 13L, 12L,
11L, 10L, 9L, 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L,
29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L,
41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 49L, 48L, 47L,
46L, 45L, 44L, 43L, 42L, 41L, 40L, 39L, 38L, 37L, 36L, 35L,
34L, 33L, 32L, 31L, 30L, 29L, 28L, 27L, 26L, 25L, 24L, 23L,
22L, 21L, 20L, 19L, 18L, 17L, 16L, 15L, 14L, 13L, 12L, 11L,
10L, 9L, 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,
18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L,
30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L,
42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 49L, 48L, 47L, 46L,
45L, 44L, 43L, 42L, 41L, 40L, 39L, 38L, 37L, 36L, 35L, 34L,
33L, 32L, 31L, 30L, 29L, 28L, 27L, 26L, 25L, 24L, 23L, 22L,
21L, 20L, 19L, 18L, 17L, 16L, 15L, 14L, 13L, 12L, 11L, 10L,
9L, 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L,
31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L,
43L, 44L, 45L, 46L, 47L, 48L, 49L, 49L, 48L, 47L, 46L, 45L,
44L, 43L, 42L, 41L, 40L, 39L, 38L, 37L, 36L, 35L, 34L, 33L,
32L, 31L, 30L, 29L, 28L, 27L, 26L, 25L, 24L, 23L, 22L, 21L,
20L, 19L, 18L, 17L, 16L, 15L, 14L, 13L, 12L, 11L, 10L, 9L,
8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L,
20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L,
32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L,
44L, 45L, 46L, 47L, 48L, 49L, 49L, 48L, 47L, 46L, 45L, 44L,
43L, 42L, 41L, 40L, 39L, 38L, 37L, 36L, 35L, 34L, 33L, 32L,
31L, 30L, 29L, 28L, 27L, 26L, 25L, 24L, 23L, 22L, 21L, 20L,
19L, 18L, 17L, 16L, 15L, 14L, 13L, 12L, 11L, 10L, 9L, 8L,
7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L,
33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L,
45L, 46L, 47L, 48L, 49L, 49L, 48L, 47L, 46L, 45L, 44L, 43L,
42L, 41L, 40L, 39L, 38L, 37L, 36L, 35L, 34L, 33L, 32L, 31L,
30L, 29L, 28L, 27L, 26L, 25L, 24L, 23L, 22L, 21L, 20L, 19L,
18L, 17L, 16L, 15L, 14L, 13L, 12L, 11L, 10L, 9L, 8L, 7L,
6L, 5L, 4L, 3L, 2L, 1L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L,
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L,
22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L,
34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L,
46L, 47L, 48L, 49L), Value = c(3597L, 3519L, 2974L, 3499L,
3437L, 3669L, 2972L, 2953L, 3088L, 3224L, 2739L, 2762L, 3238L,
2838L, 2821L, 2765L, 3487L, 3696L, 3708L, 3369L, 3702L, 3362L,
3275L, 3073L, 3313L, 3316L, 3656L, 3898L, 3999L, 4074L, 3768L,
3846L, 3630L, 4130L, 3787L, 3418L, 3053L, 3764L, 3745L, 3187L,
3628L, 3147L, 3441L, 3465L, 3953L, 3288L, 3122L, 2208L, 3008L,
3487L, 3248L, 3411L, 3402L, 3627L, 3232L, 3713L, 3432L, 3657L,
3282L, 3859L, 3464L, 3161L, 3297L, 3308L, 3392L, 3334L, 3187L,
3396L, 3213L, 4019L, 3516L, 3578L, 3670L, 3484L, 3552L, 3365L,
3441L, 4022L, 3881L, 3343L, 3466L, 3128L, 3477L, 3398L, 3761L,
3540L, 3627L, 2864L, 3630L, 3320L, 3849L, 3939L, 3658L, 3424L,
3524L, 3626L, 3177L, 2923L, 3655L, 3750L, 4447L, 4426L, 4891L,
4705L, 4274L, 4398L, 4448L, 4148L, 4210L, 4141L, 4255L, 4083L,
4295L, 3190L, 3939L, 3258L, 3855L, 4181L, 3930L, 3871L, 3977L,
3594L, 4107L, 3416L, 4057L, 3692L, 3967L, 3943L, 4012L, 3852L,
4065L, 4019L, 3687L, 3663L, 4081L, 4015L, 3847L, 3690L, 3994L,
3447L, 3559L, 3636L, 3409L, 3121L, 2958L, 2899L, 3017L, 3158L,
3053L, 3572L, 2975L, 3431L, 3725L, 3702L, 3363L, 3487L, 3562L,
3190L, 3219L, 3923L, 3585L, 3989L, 4005L, 3658L, 3810L, 3983L,
3555L, 3712L, 3699L, 3774L, 3471L, 3428L, 3552L, 3468L, 3099L,
3069L, 3303L, 3470L, 3637L, 3624L, 3813L, 4344L, 3866L, 4044L,
3490L, 3809L, 3428L, 3839L, 2540L, 4349L, 3584L, 3627L, 3799L,
3800L, 2887L, 3523L, 3389L, 3411L, 3193L, 3111L, 3112L, 3222L,
3363L, 3551L, 3430L, 3483L, 3049L, 3340L, 4034L, 3447L, 3865L,
3626L, 3699L, 3758L, 4002L, 3500L, 3650L, 3354L, 3321L, 4088L,
3259L, 3520L, 3444L, 3191L, 3578L, 3369L, 2479L, 4070L, 4171L,
4093L, 4184L, 4295L, 2681L, 3597L, 3901L, 2720L, 2700L, 2717L,
3483L, 3311L, 3223L, 3046L, 3310L, 2531L, 3317L, 3233L, 2134L,
3020L, 3360L, 3679L, 2773L, 3665L, 3124L, 4042L, 3713L, 3862L,
3961L, 4109L, 3794L, 4062L, 4078L, 4181L, 3940L, 4602L, 4149L,
3849L, 3582L, 4035L, 3431L, 3954L, 4244L, 3353L, 3519L, 3496L,
3408L, 2988L, 3327L, 3086L, 3180L, 4583L, 3742L, 4580L, 4707L,
4247L, 4422L, 4426L, 4100L, 4042L, 4096L, 3703L, 4001L, 4002L,
4265L, 3249L, 4765L, 4280L, 4628L, 4905L, 4611L, 4010L, 4125L,
4452L, 5044L, 4932L, 4613L, 4768L, 5033L, 4199L, 3944L, 3951L,
4179L, 4192L, 4195L, 3889L, 3928L, 3301L, 3764L, 3537L, 3843L,
4342L, 3792L, 3973L, 4251L, 4169L, 4374L, 4172L, 4028L, 3050L,
4488L, 4068L, 4697L, 4824L, 4184L, 3930L, 4012L, 3219L, 3519L,
3663L, 3493L, 2939L, 3363L, 3383L, 3464L, 2789L, 2927L, 3059L,
2884L, 2782L, 3090L, 3158L, 3132L, 3644L, 3803L, 3895L, 3885L,
3265L, 3682L, 3464L, 3171L, 3539L, 3474L, 3265L, 3666L, 3549L,
3591L, 3249L, 3173L, 3088L, 2563L, 3530L, 3234L, 3453L, 3200L,
3405L, 3471L, 3750L, 2906L, 3241L, 3186L, 3789L, 3174L, 2977L,
3281L, 3479L, 3241L, 3783L, 3339L, 3503L, 3591L, 3379L, 3392L,
3399L, 3675L, 3624L, 3772L, 3873L, 3477L, 3950L, 3538L, 4347L,
3818L, 4332L, 3727L, 4028L, 3679L, 3737L, 3444L, 3258L, 3535L,
3555L, 3474L, 3447L, 3748L, 3423L, 3577L, 3725L, 3227L, 2903L,
3526L, 3670L, 3256L, 3282L, 3396L, 3719L, 3598L, 3608L, 3259L,
3610L, 3373L, 3432L, 3393L, 3001L, 2867L, 2982L, 3345L, 3311L,
2727L, 3106L, 3108L, 2950L, 2714L, 3520L, 3016L, 2939L, 3435L,
3020L, 3175L, 3805L, 2779L, 3895L, 3308L, 2995L, 3083L, 3080L,
3432L, 3318L, 4486L, 3876L, 3588L, 3742L, 3986L, 3765L, 3758L,
3523L, 3696L, 3040L, 3448L, 2687L, 3282L, 4166L, 4169L, 3742L,
4032L, 3986L, 4306L, 4371L, 4231L, 4260L, 3585L, 4342L, 4188L,
3220L, 3464L, 3536L, 3595L, 4045L, 3937L, 3886L, 4774L, 3696L,
4214L, 4250L, 4543L, 4550L, 4517L, 4691L, 5042L, 3956L, 3953L,
3986L, 4032L, 3643L, 3562L, 3833L, 3803L, 3634L, 3895L, 4299L,
3862L, 3403L, 3272L, 3406L, 3253L, 3233L, 3344L, 3481L, 3363L,
2646L, 3631L, 3869L, 3246L, 3357L, 3696L, 3859L, 4296L, 3438L,
4000L, 3703L, 3960L, 3477L, 4247L, 3791L, 3853L, 3696L, 3835L,
3742L, 3588L, 3276L, 3093L, 3360L, 3207L, 3576L, 3025L, 3305L,
3295L, 3788L, 3963L, 3999L, 3294L, 3931L, 3448L, 2959L, 3304L,
3131L, 2685L, 3314L, 2887L, 3653L, 3141L, 3425L, 3542L, 3282L,
3478L, 3191L, 2639L, 3027L, 3504L, 3578L, 2806L, 4163L, 3735L,
3203L, 3419L, 3588L, 3545L, 3535L, 3333L, 3392L, 3806L, 3587L,
3134L, 2971L, 3069L, 3316L, 4520L, 3562L, 3665L, 3744L, 3207L,
3409L, 3744L, 3181L, 3096L, 3576L, 3572L, 3363L, 3386L, 3318L,
3791L, 3582L, 4032L, 4394L, 4087L, 4248L, 4342L, 4189L, 4656L,
3781L, 4335L, 3504L, 4267L, 4032L, 3824L, 3609L, 4012L, 3992L,
4417L, 4003L, 3846L, 4140L, 3683L, 3302L, 3859L, 4100L, 3847L,
3621L, 4176L, 4359L, 4081L, 3654L, 4062L, 3442L, 3560L, 3780L,
3295L, 3487L, 3409L, 3439L, 2362L, 3364L, 3412L, 3266L, 4051L,
3990L, 4068L, 3971L, 3197L, 3677L, 3765L, 3638L, 3439L, 4004L,
3648L, 3628L, 3475L, 3945L, 4167L, 3942L, 3929L, 4013L, 3906L,
3168L, 3606L, 4012L, 4317L, 4000L, 3781L, 4199L, 3997L, 4576L,
3997L, 4273L, 3891L, 3543L, 3294L, 3911L, 3715L, 4276L, 3660L,
4090L, 3921L, 3595L, 3513L, 3301L, 3470L, 3363L, 3989L, 3307L,
3565L, 3301L, 3738L, 3907L, 3653L, 3819L, 3232L, 3695L, 3435L,
2906L, 3620L, 3686L, 3284L, 4237L, 4100L, 4420L, 3654L, 2503L,
1680L, 3614L, 3314L, 4302L, 3114L, 2840L, 3036L, 1144L, 4153L,
3416L, 4484L, 3159L, 3839L, 3961L, 3373L, 3722L, 3605L, 3116L,
3818L, 3977L, 3527L, 3562L, 3794L, 4162L, 3800L, 3680L, 3578L,
3924L, 3484L, 3204L, 3200L, 3223L, 3536L, 3187L, 3171L, 3057L,
3268L, 3099L, 3517L, 3477L, 3751L, 3174L, 3569L, 3295L, 3229L,
3451L, 3200L, 3530L, 3798L, 3562L, 3484L, 2718L, 3980L, 3746L,
3576L, 3464L, 3302L, 4107L, 3452L, 3315L, 3680L, 3383L, 3462L,
3478L, 3888L, 3634L, 3445L, 3092L, 3445L, 2923L, 3040L, 2623L,
2874L, 3552L, 2336L, 3011L, 2671L, 2029L, 4002L, 3379L, 3779L,
3763L, 3496L, 3454L, 3613L, 3901L, 3727L, 3365L, 3836L, 2750L,
3763L, 3389L, 3542L, 3699L, 3904L, 3836L, 3399L, 3634L, 4162L,
3545L, 4182L, 3506L, 3849L, 3755L, 3770L, 2936L, 3670L, 3758L,
3487L, 3807L, 2868L, 3523L, 3148L, 3774L, 2851L, 2903L, 3181L,
3067L, 2695L, 3389L, 3670L, 2554L, 3494L, 4162L, 3533L, 2780L,
2822L, 2946L, 3324L, 1791L, 3530L, 3872L, 3676L, 3252L, 3395L,
3370L, 2662L, 2567L, 2786L, 2714L, 2479L, 1465L, 2000L, 3663L,
4375L, 3758L, 3742L, 3259L, 2985L, 3784L, 3373L, 2978L, 3487L,
3379L, 2953L, 3478L, 2890L, 2597L, 3001L, 2861L, 3988L, 3455L,
2950L, 3771L, 3550L, 2998L, 2991L, 3219L, 3073L, 3458L, 3585L,
3546L, 3637L, 4198L, 2903L, 3144L, 2825L, 2806L, 3409L, 1846L,
2564L, 3005L, 2675L, 2936L, 2124L, 2900L, 2388L, 2531L, 2916L,
778L, 2812L, 2577L, 2401L, 2868L, 3041L, 2039L, 2408L, 2104L,
3142L, 2610L, 3748L, 3370L, 2754L, 3546L, 2962L, 2453L, 3014L,
2626L, 2864L, 3399L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L)), class = "data.frame", row.names = c(NA,
-931L), .Names = c("Entr", "Row", "Col", "Value"))
## Control every 10
b$Control[b$Entr%%10==0] <- 1
b$Control[is.na(b$Control)] <- 0
## Isolate controls
b$Yield2[b$Control==1] <- b$Value[b$Control==1]
b$Yield2[is.na(b$Yield2)] <- 0
## -------------------- GENERATE MATRIX FOR SURFACE CALCULATION----------------
## ALL DATA
MaxCol <- max(b$Col)
MaxRow <- max(b$Row)
RealSurf <- matrix(b$Value,MaxRow,MaxCol)
## Matrix of just controls, first emptyish
ControlSurf <- matrix(b$Yield2,MaxRow,MaxCol)
## Interpolate empty data...
idx <- which(ControlSurf > 0, arr.ind=TRUE)
RealSurf.nz <- ControlSurf[idx]
## ... into a fullish matrix
InterpolatedControls <- interp.new(idx[,1], idx[,2], RealSurf.nz, xo=1:MaxRow, yo=1:MaxCol, extrap=TRUE)
ControlSurf <- matrix(InterpolatedControls$z,MaxRow,MaxCol)
##################### ???????????? IS THIS EVEN CORRECT??????? ##################
## Plot surfaces
par(mfrow=c(1,2))
persp( z=ControlSurf, theta = 50, phi = 30, expand = 0.1, col = "lightblue")
persp( z=RealSurf, theta = 50, phi = 30, expand = 0.1, col = "red")
## How to make the real surface "poke" through the Control Surface?