I have List Y and List Z as per below:
For example:
List Y:
[[1]]
[[1]]$`1`
   V1 V2
 1  1  1
 2  1  2
 3  2  1
 4  2  2
[[1]]$`2`
   V1 V2
9   5  5
10  5  6
[[1]]$`3`
   V1 V2
 5 10  1
 6 10  2
 7 11  1
 8 11  2
[[2]]
[[2]]$`1`
   V1 V2
1   1  1
2   1  2
3   2  1
4   2  2
9   5  5
10  5  6
[[2]]$`2`
   V1 V2
 5 10  1
 7 11  1
 8 11  2
[[2]]$`3`
   V1 V2
 6 10  2
List Z:
 [[1]]
 [[1]]$`1`
 [1] 2 1
 [[1]]$`2`
 [1] 5 5
 [[1]]$`3`
 [1] 10  1
 [[2]]
 [[2]]$`1`
 [1] 1 1
 [[2]]$`2`
 [1] 11  1
 [[2]]$`3`
 [1] 10  2
I want to do calculation between List Y and List Z:
      (|y-z|+|y-z|)^2
Such that all elements in ListY[[1]]$1 minus ListZ[[1]]$1 next, 
all elements in ListY[[1]]$2 minus ListZ[[1]]$2 next,
all elements in ListY[[1]]$3 minus ListZ[[1]]$3 
Same goes to ListY[[2]] and List Z[[2]]
 Expected output for (|y-z| + |y-z|)^2 between ListY[[1]] and ListZ[[1]]:
  > 
    $`1`
    1  2  3  4   
    1  2  0  1 
    $`2`
    9 10 
    0  1 
    $`3`
    5 6 7 8
    0 1 1 2
     Expected output for (|y-z| + |y-z|)^2 between ListY[[2]] and ListZ[[2]]:
    > 
    $`1`
    1  2  3  4  5 9 10 
    1  0  0  1
    $`2`
    5 7 8 
    1 0 1
    $`3`
    6  
    0 
For example, this is how I get the expected outcome:
   Y[[1]]
    [[1]]$`1`
       V1 V2
     1  1  1
     2  1  2
     3  2  1
     4  2  2
    [[1]]
    [[1]]$`1`
    [1] 2 1
   (|1-2|+|1-1|)^2 = 1
   (|1-2|+|2-1|)^2 = 4
   (|2-2|+|1-1|)^2 = 0
   (|2-2|+|2-1|)^2 = 1
   $`1`
    1  2  3  4  5 9 10 
    1  4  0  1
How can I do this in R?
 
     
    