Related
I am currently trying to find a solution to a transportation problem. I have a table with the travel times from 30 customers to each other. The goal is to use dynamic program to go from this table with direct durations to a table with shortest duration possible (via possible subtours between pairs of customers)
I have no clue how to solve this. The question states "Let π·π,π,π be the shortest (in duration) path between customer π and π, using only nodes 0 to π as intermediaries."
Is there someone who can help me with this?
Thank you in advance. :-)
to use only nodes 0 to k as intermediates.
structure(list(ID = 1:30, X1 = c(0L, 98L, 132L, 245L, 17L, 69L,
139L, 112L, 207L, 35L, 249L, 43L, 215L, 62L, 152L, 237L, 59L,
119L, 45L, 59L, 23L, 12L, 16L, 66L, 177L, 31L, 118L, 165L, 117L,
193L), X2 = c(37L, 0L, 74L, 176L, 91L, 111L, 143L, 208L, 202L,
40L, 172L, 101L, 163L, 51L, 220L, 180L, 48L, 98L, 45L, 62L, 91L,
9L, 50L, 145L, 198L, 48L, 3L, 163L, 159L, 176L), X3 = c(118L,
10L, 0L, 138L, 108L, 115L, 221L, 274L, 231L, 89L, 197L, 36L,
175L, 93L, 174L, 184L, 13L, 109L, 109L, 22L, 172L, 91L, 12L,
149L, 140L, 108L, 8L, 133L, 168L, 139L), X4 = c(252L, 137L, 112L,
0L, 248L, 276L, 373L, 350L, 353L, 137L, 31L, 186L, 49L, 170L,
325L, 81L, 117L, 184L, 175L, 185L, 279L, 182L, 120L, 205L, 130L,
132L, 133L, 226L, 158L, 67L), X5 = c(40L, 93L, 118L, 188L, 0L,
38L, 147L, 106L, 208L, 46L, 228L, 26L, 208L, 54L, 163L, 212L,
81L, 49L, 45L, 84L, 12L, 82L, 114L, 81L, 173L, 67L, 52L, 63L,
146L, 156L), X6 = c(54L, 117L, 143L, 296L, 74L, 0L, 78L, 97L,
218L, 52L, 239L, 47L, 267L, 111L, 216L, 269L, 167L, 91L, 105L,
99L, 16L, 117L, 95L, 15L, 264L, 136L, 148L, 100L, 145L, 242L),
X7 = c(143L, 145L, 208L, 302L, 130L, 86L, 0L, 84L, 308L,
151L, 348L, 102L, 305L, 139L, 254L, 272L, 156L, 182L, 87L,
214L, 110L, 82L, 145L, 59L, 283L, 98L, 171L, 192L, 211L,
228L), X8 = c(142L, 195L, 238L, 336L, 161L, 80L, 2L, 0L,
289L, 135L, 342L, 134L, 307L, 169L, 197L, 347L, 261L, 143L,
128L, 243L, 52L, 128L, 169L, 97L, 318L, 214L, 229L, 225L,
287L, 288L), X9 = c(230L, 238L, 217L, 264L, 229L, 154L, 299L,
269L, 0L, 210L, 335L, 204L, 342L, 260L, 25L, 258L, 264L,
76L, 170L, 222L, 126L, 193L, 272L, 203L, 218L, 186L, 214L,
120L, 240L, 207L), X10 = c(2L, 30L, 34L, 186L, 75L, 96L,
161L, 179L, 244L, 0L, 199L, 17L, 181L, 59L, 240L, 178L, 101L,
117L, 1L, 48L, 79L, 72L, 24L, 60L, 236L, 5L, 32L, 151L, 203L,
133L), X11 = c(243L, 191L, 114L, 38L, 164L, 211L, 295L, 370L,
350L, 211L, 0L, 174L, 14L, 166L, 278L, 164L, 165L, 223L,
252L, 129L, 201L, 196L, 201L, 271L, 98L, 199L, 209L, 219L,
168L, 62L), X12 = c(22L, 14L, 64L, 164L, 68L, 113L, 117L,
115L, 208L, 8L, 239L, 0L, 204L, 36L, 230L, 217L, 37L, 62L,
41L, 30L, 64L, 25L, 22L, 60L, 150L, 30L, 90L, 109L, 92L,
178L), X13 = c(224L, 168L, 120L, 23L, 213L, 310L, 324L, 377L,
366L, 212L, 54L, 178L, 0L, 207L, 316L, 105L, 117L, 266L,
235L, 106L, 231L, 186L, 147L, 223L, 109L, 182L, 211L, 183L,
130L, 132L), X14 = c(66L, 22L, 77L, 204L, 23L, 143L, 93L,
171L, 259L, 37L, 182L, 68L, 218L, 0L, 216L, 186L, 56L, 139L,
65L, 44L, 118L, 64L, 19L, 112L, 183L, 14L, 40L, 142L, 96L,
131L), X15 = c(167L, 236L, 263L, 275L, 187L, 189L, 212L,
282L, 9L, 181L, 309L, 231L, 340L, 238L, 0L, 207L, 216L, 97L,
204L, 237L, 120L, 160L, 217L, 188L, 258L, 203L, 183L, 106L,
174L, 267L), X16 = c(173L, 196L, 161L, 152L, 168L, 268L,
322L, 280L, 265L, 230L, 133L, 160L, 102L, 209L, 193L, 0L,
162L, 168L, 228L, 208L, 283L, 159L, 195L, 270L, 14L, 233L,
176L, 172L, 48L, 38L), X17 = c(70L, 44L, 13L, 184L, 90L,
186L, 194L, 267L, 257L, 72L, 179L, 38L, 107L, 88L, 177L,
172L, 0L, 93L, 71L, 14L, 167L, 117L, 37L, 146L, 116L, 35L,
62L, 83L, 93L, 129L), X18 = c(115L, 128L, 153L, 196L, 78L,
109L, 147L, 185L, 103L, 138L, 218L, 123L, 200L, 85L, 91L,
178L, 86L, 0L, 35L, 125L, 67L, 68L, 142L, 42L, 202L, 84L,
81L, 91L, 87L, 210L), X19 = c(36L, 104L, 71L, 166L, 16L,
99L, 88L, 133L, 200L, 35L, 246L, 2L, 263L, 89L, 144L, 229L,
47L, 103L, 0L, 31L, 114L, 32L, 44L, 106L, 219L, 43L, 92L,
119L, 150L, 103L), X20 = c(74L, 66L, 22L, 101L, 76L, 101L,
194L, 211L, 170L, 21L, 179L, 105L, 197L, 36L, 180L, 204L,
48L, 71L, 59L, 0L, 178L, 32L, 58L, 125L, 180L, 46L, 16L,
77L, 130L, 75L), X21 = c(85L, 158L, 144L, 210L, 29L, 16L,
44L, 65L, 141L, 88L, 258L, 70L, 279L, 124L, 168L, 190L, 145L,
45L, 40L, 110L, 0L, 129L, 157L, 52L, 177L, 117L, 175L, 153L,
133L, 190L), X22 = c(25L, 44L, 124L, 236L, 62L, 39L, 108L,
149L, 175L, 18L, 177L, 16L, 259L, 44L, 163L, 179L, 74L, 110L,
28L, 104L, 110L, 0L, 97L, 123L, 216L, 5L, 112L, 170L, 153L,
196L), X23 = c(26L, 2L, 39L, 205L, 102L, 74L, 205L, 203L,
257L, 49L, 194L, 96L, 207L, 5L, 174L, 160L, 37L, 159L, 55L,
55L, 91L, 1L, 0L, 153L, 216L, 52L, 11L, 192L, 116L, 149L),
X24 = c(12L, 127L, 115L, 288L, 90L, 60L, 73L, 79L, 194L,
87L, 203L, 81L, 257L, 108L, 188L, 263L, 185L, 90L, 25L, 177L,
51L, 85L, 93L, 0L, 234L, 114L, 111L, 72L, 131L, 153L), X25 = c(194L,
120L, 191L, 143L, 212L, 253L, 281L, 318L, 291L, 160L, 108L,
174L, 94L, 188L, 203L, 43L, 127L, 153L, 204L, 162L, 170L,
237L, 194L, 251L, 0L, 237L, 122L, 149L, 75L, 104L), X26 = c(10L,
58L, 22L, 171L, 101L, 131L, 144L, 154L, 177L, 5L, 222L, 48L,
220L, 59L, 192L, 193L, 9L, 134L, 23L, 80L, 75L, 19L, 19L,
132L, 197L, 0L, 57L, 146L, 163L, 154L), X27 = c(104L, 58L,
15L, 175L, 46L, 178L, 206L, 185L, 199L, 44L, 191L, 115L,
211L, 33L, 200L, 148L, 25L, 104L, 47L, 8L, 154L, 35L, 41L,
106L, 159L, 14L, 0L, 171L, 88L, 87L), X28 = c(80L, 137L,
93L, 225L, 76L, 138L, 245L, 195L, 102L, 130L, 197L, 112L,
169L, 163L, 68L, 83L, 108L, 50L, 125L, 108L, 139L, 106L,
131L, 111L, 136L, 179L, 150L, 0L, 103L, 151L), X29 = c(170L,
113L, 89L, 120L, 138L, 172L, 224L, 263L, 233L, 155L, 170L,
132L, 194L, 133L, 160L, 99L, 106L, 86L, 154L, 90L, 132L,
158L, 142L, 209L, 55L, 127L, 118L, 93L, 0L, 67L), X30 = c(197L,
170L, 155L, 66L, 178L, 193L, 226L, 303L, 213L, 161L, 104L,
94L, 140L, 138L, 241L, 29L, 102L, 131L, 108L, 129L, 182L,
167L, 167L, 198L, 83L, 154L, 89L, 106L, 87L, 0L)), class = "data.frame", row.names = c(NA,
-30L))
Following up on my comment to use the igraph package, below is a way to accomplish what is described.
library(igraph)
m <- data.frame(X1 = c(0L, 98L, 132L, 245L, 17L, 69L, 139L, 112L, 207L, 35L, 249L, 43L, 215L, 62L, 152L, 237L, 59L, 119L, 45L, 59L, 23L, 12L, 16L, 66L, 177L, 31L, 118L, 165L, 117L, 193L),
X2 = c(37L, 0L, 74L, 176L, 91L, 111L, 143L, 208L, 202L, 40L, 172L, 101L, 163L, 51L, 220L, 180L, 48L, 98L, 45L, 62L, 91L, 9L, 50L, 145L, 198L, 48L, 3L, 163L, 159L, 176L),
X3 = c(118L, 10L, 0L, 138L, 108L, 115L, 221L, 274L, 231L, 89L, 197L, 36L, 175L, 93L, 174L, 184L, 13L, 109L, 109L, 22L, 172L, 91L, 12L, 149L, 140L, 108L, 8L, 133L, 168L, 139L),
X4 = c(252L, 137L, 112L, 0L, 248L, 276L, 373L, 350L, 353L, 137L, 31L, 186L, 49L, 170L, 325L, 81L, 117L, 184L, 175L, 185L, 279L, 182L, 120L, 205L, 130L, 132L, 133L, 226L, 158L, 67L),
X5 = c(40L, 93L, 118L, 188L, 0L, 38L, 147L, 106L, 208L, 46L, 228L, 26L, 208L, 54L, 163L, 212L, 81L, 49L, 45L, 84L, 12L, 82L, 114L, 81L, 173L, 67L, 52L, 63L, 146L, 156L),
X6 = c(54L, 117L, 143L, 296L, 74L, 0L, 78L, 97L, 218L, 52L, 239L, 47L, 267L, 111L, 216L, 269L, 167L, 91L, 105L, 99L, 16L, 117L, 95L, 15L, 264L, 136L, 148L, 100L, 145L, 242L),
X7 = c(143L, 145L, 208L, 302L, 130L, 86L, 0L, 84L, 308L, 151L, 348L, 102L, 305L, 139L, 254L, 272L, 156L, 182L, 87L, 214L, 110L, 82L, 145L, 59L, 283L, 98L, 171L, 192L, 211L, 228L),
X8 = c(142L, 195L, 238L, 336L, 161L, 80L, 2L, 0L, 289L, 135L, 342L, 134L, 307L, 169L, 197L, 347L, 261L, 143L, 128L, 243L, 52L, 128L, 169L, 97L, 318L, 214L, 229L, 225L, 287L, 288L),
X9 = c(230L, 238L, 217L, 264L, 229L, 154L, 299L, 269L, 0L, 210L, 335L, 204L, 342L, 260L, 25L, 258L, 264L, 76L, 170L, 222L, 126L, 193L, 272L, 203L, 218L, 186L, 214L, 120L, 240L, 207L),
X10 = c(2L, 30L, 34L, 186L, 75L, 96L, 161L, 179L, 244L, 0L, 199L, 17L, 181L, 59L, 240L, 178L, 101L, 117L, 1L, 48L, 79L, 72L, 24L, 60L, 236L, 5L, 32L, 151L, 203L, 133L),
X11 = c(243L, 191L, 114L, 38L, 164L, 211L, 295L, 370L, 350L, 211L, 0L, 174L, 14L, 166L, 278L, 164L, 165L, 223L, 252L, 129L, 201L, 196L, 201L, 271L, 98L, 199L, 209L, 219L, 168L, 62L),
X12 = c(22L, 14L, 64L, 164L, 68L, 113L, 117L, 115L, 208L, 8L, 239L, 0L, 204L, 36L, 230L, 217L, 37L, 62L, 41L, 30L, 64L, 25L, 22L, 60L, 150L, 30L, 90L, 109L, 92L, 178L),
X13 = c(224L, 168L, 120L, 23L, 213L, 310L, 324L, 377L, 366L, 212L, 54L, 178L, 0L, 207L, 316L, 105L, 117L, 266L, 235L, 106L, 231L, 186L, 147L, 223L, 109L, 182L, 211L, 183L, 130L, 132L),
X14 = c(66L, 22L, 77L, 204L, 23L, 143L, 93L, 171L, 259L, 37L, 182L, 68L, 218L, 0L, 216L, 186L, 56L, 139L, 65L, 44L, 118L, 64L, 19L, 112L, 183L, 14L, 40L, 142L, 96L, 131L),
X15 = c(167L, 236L, 263L, 275L, 187L, 189L, 212L, 282L, 9L, 181L, 309L, 231L, 340L, 238L, 0L, 207L, 216L, 97L, 204L, 237L, 120L, 160L, 217L, 188L, 258L, 203L, 183L, 106L, 174L, 267L),
X16 = c(173L, 196L, 161L, 152L, 168L, 268L, 322L, 280L, 265L, 230L, 133L, 160L, 102L, 209L, 193L, 0L, 162L, 168L, 228L, 208L, 283L, 159L, 195L, 270L, 14L, 233L, 176L, 172L, 48L, 38L),
X17 = c(70L, 44L, 13L, 184L, 90L, 186L, 194L, 267L, 257L, 72L, 179L, 38L, 107L, 88L, 177L, 172L, 0L, 93L, 71L, 14L, 167L, 117L, 37L, 146L, 116L, 35L, 62L, 83L, 93L, 129L),
X18 = c(115L, 128L, 153L, 196L, 78L, 109L, 147L, 185L, 103L, 138L, 218L, 123L, 200L, 85L, 91L, 178L, 86L, 0L, 35L, 125L, 67L, 68L, 142L, 42L, 202L, 84L, 81L, 91L, 87L, 210L),
X19 = c(36L, 104L, 71L, 166L, 16L, 99L, 88L, 133L, 200L, 35L, 246L, 2L, 263L, 89L, 144L, 229L, 47L, 103L, 0L, 31L, 114L, 32L, 44L, 106L, 219L, 43L, 92L, 119L, 150L, 103L),
X20 = c(74L, 66L, 22L, 101L, 76L, 101L, 194L, 211L, 170L, 21L, 179L, 105L, 197L, 36L, 180L, 204L, 48L, 71L, 59L, 0L, 178L, 32L, 58L, 125L, 180L, 46L, 16L, 77L, 130L, 75L),
X21 = c(85L, 158L, 144L, 210L, 29L, 16L, 44L, 65L, 141L, 88L, 258L, 70L, 279L, 124L, 168L, 190L, 145L, 45L, 40L, 110L, 0L, 129L, 157L, 52L, 177L, 117L, 175L, 153L, 133L, 190L),
X22 = c(25L, 44L, 124L, 236L, 62L, 39L, 108L, 149L, 175L, 18L, 177L, 16L, 259L, 44L, 163L, 179L, 74L, 110L, 28L, 104L, 110L, 0L, 97L, 123L, 216L, 5L, 112L, 170L, 153L, 196L),
X23 = c(26L, 2L, 39L, 205L, 102L, 74L, 205L, 203L, 257L, 49L, 194L, 96L, 207L, 5L, 174L, 160L, 37L, 159L, 55L, 55L, 91L, 1L, 0L, 153L, 216L, 52L, 11L, 192L, 116L, 149L),
X24 = c(12L, 127L, 115L, 288L, 90L, 60L, 73L, 79L, 194L, 87L, 203L, 81L, 257L, 108L, 188L, 263L, 185L, 90L, 25L, 177L, 51L, 85L, 93L, 0L, 234L, 114L, 111L, 72L, 131L, 153L),
X25 = c(194L, 120L, 191L, 143L, 212L, 253L, 281L, 318L, 291L, 160L, 108L, 174L, 94L, 188L, 203L, 43L, 127L, 153L, 204L, 162L, 170L, 237L, 194L, 251L, 0L, 237L, 122L, 149L, 75L, 104L),
X26 = c(10L, 58L, 22L, 171L, 101L, 131L, 144L, 154L, 177L, 5L, 222L, 48L, 220L, 59L, 192L, 193L, 9L, 134L, 23L, 80L, 75L, 19L, 19L, 132L, 197L, 0L, 57L, 146L, 163L, 154L),
X27 = c(104L, 58L, 15L, 175L, 46L, 178L, 206L, 185L, 199L, 44L, 191L, 115L, 211L, 33L, 200L, 148L, 25L, 104L, 47L, 8L, 154L, 35L, 41L, 106L, 159L, 14L, 0L, 171L, 88L, 87L),
X28 = c(80L, 137L, 93L, 225L, 76L, 138L, 245L, 195L, 102L, 130L, 197L, 112L, 169L, 163L, 68L, 83L, 108L, 50L, 125L, 108L, 139L, 106L, 131L, 111L, 136L, 179L, 150L, 0L, 103L, 151L),
X29 = c(170L, 113L, 89L, 120L, 138L, 172L, 224L, 263L, 233L, 155L, 170L, 132L, 194L, 133L, 160L, 99L, 106L, 86L, 154L, 90L, 132L, 158L, 142L, 209L, 55L, 127L, 118L, 93L, 0L, 67L),
X30 = c(197L, 170L, 155L, 66L, 178L, 193L, 226L, 303L, 213L, 161L, 104L, 94L, 140L, 138L, 241L, 29L, 102L, 131L, 108L, 129L, 182L, 167L, 167L, 198L, 83L, 154L, 89L, 106L, 87L, 0L))
system.time({
g <- graph_from_adjacency_matrix(as.matrix(m), "directed", TRUE, FALSE)
mOpt <- shortest.paths(g, V(g), V(g), mode = "out")
})
#> user system elapsed
#> 0 0 0
mOpt[1:10, 1:10]
#> X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
#> X1 0 21 25 133 36 27 71 73 123 2
#> X2 18 0 10 122 40 45 89 91 127 17
#> X3 36 18 0 112 58 63 107 109 145 27
#> X4 130 112 117 0 152 157 201 203 239 129
#> X5 17 36 40 148 0 44 88 81 127 17
#> X6 39 48 52 160 28 0 86 68 142 41
#> X7 67 88 92 200 56 60 0 2 170 69
#> X8 88 109 113 221 77 81 84 0 191 90
#> X9 157 165 170 250 140 157 208 193 0 154
#> X10 22 19 23 131 34 49 92 94 121 0
mOptPaths <- lapply(V(g), function(from) all_shortest_paths(g, from = from, mode = "out"))
# optimal path from 1 to 2
(path_1_2 <- as.integer(mOptPaths[[1]]$res[[2]]))
#> [1] 1 10 26 22 2
# distances for path from 1 to 2
m[matrix(c(head(path_1_2, -1), path_1_2[-1]), ncol = 2)]
#> [1] 2 5 5 9
I try do define the model for my test and training dataset. But I get the following Error:
Error in eval(predvars, data, env) : object 'avg_rating' not found
But all of my datasets have the "avg_rating"
This is my code
lm_model <- train(avg_rating ~., data = trainingindex,method = "lm",na.action = na.omit, preProcess = c("scale", "center"),trControl = trainControl(method = "none"))
structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 21L, 23L, 24L, 25L, 27L, 28L, 29L, 30L,
31L, 32L, 33L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L,
45L, 46L, 47L, 48L, 49L, 52L, 53L, 55L, 58L, 61L, 62L, 63L, 65L,
66L, 67L, 68L, 69L, 70L, 71L, 74L, 77L, 78L, 80L, 81L, 83L, 84L,
85L, 86L, 87L, 88L, 90L, 91L, 92L, 93L, 94L, 96L, 97L, 99L, 102L,
103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L, 113L, 115L,
116L, 118L, 119L, 120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L,
128L, 129L, 130L, 131L, 132L, 133L, 134L, 135L, 136L, 137L, 138L,
139L, 140L, 141L, 142L, 143L, 144L, 145L, 146L, 147L, 148L, 150L,
152L, 154L, 155L, 157L, 158L, 160L, 161L, 162L, 165L, 166L, 167L,
168L, 170L, 171L, 172L, 173L, 174L, 175L, 176L, 177L, 178L, 179L,
180L, 181L, 182L, 185L, 187L, 188L, 189L, 190L, 191L, 192L, 193L,
194L, 195L, 196L, 197L, 199L, 200L, 201L, 202L, 203L, 204L, 205L,
207L, 208L, 209L, 210L, 213L, 214L, 216L, 217L, 219L, 220L, 221L,
223L, 224L, 225L, 226L, 227L, 228L, 230L, 231L, 232L, 233L, 234L,
235L, 236L, 237L, 238L, 239L, 240L, 242L, 243L, 244L, 245L, 246L,
247L, 248L, 249L, 250L, 251L, 252L, 253L, 254L, 255L, 257L, 259L,
260L, 261L, 262L, 263L, 264L, 266L, 267L, 268L, 271L, 272L, 273L,
274L, 275L, 276L, 277L, 278L, 280L, 281L, 282L, 284L, 285L, 286L,
287L, 288L, 290L, 291L, 294L, 295L, 296L, 297L, 298L, 299L, 300L,
301L, 302L, 303L, 304L, 305L, 308L, 309L, 310L, 311L, 312L, 313L,
314L, 315L, 317L, 318L, 319L, 320L, 321L, 322L, 323L, 324L, 326L,
327L, 329L, 330L, 331L, 332L, 333L, 334L, 335L, 336L, 337L, 338L,
340L, 341L, 343L, 344L, 345L, 346L, 348L, 349L, 350L, 351L, 353L,
354L, 355L, 356L, 357L, 358L, 359L, 360L, 361L, 363L, 364L, 365L,
366L, 367L, 368L, 369L, 370L, 371L, 372L, 373L, 374L, 375L, 376L,
377L, 378L, 379L, 380L, 381L, 382L, 383L, 384L, 385L, 386L, 387L,... 3687L), .Dim = c(2952L, 1
), .Dimnames = list(NULL, "Resample1"))
15L, 16L, 17L, 18L, 19L, 21L, 23L, 24L, 25L, 27L, 28L, 29L, 30L,
31L, 32L, 33L, 35L, 36L), .Dim = c(30L, 1L), .Dimnames = list(
NULL, "Resample1"))
I have this data below. I am having problem partitioning this using caret's createPartition.
gg <- structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L,
5L, 5L, 6L, 6L, 6L, 145L, 145L, 145L, 146L, 146L, 146L, 147L,
147L, 147L, 148L, 148L, 148L, 149L, 149L, 149L, 150L, 150L, 150L,
193L, 193L, 193L, 194L, 194L, 194L, 195L, 195L, 195L, 196L, 196L,
196L, 197L, 197L, 197L, 198L, 198L, 198L, 199L, 199L, 199L, 200L,
200L, 200L, 201L, 201L, 201L, 202L, 202L, 202L, 203L, 203L, 203L,
204L, 204L, 204L, 205L, 205L, 205L, 206L, 206L, 206L, 207L, 207L,
207L, 208L, 208L, 208L, 209L, 209L, 209L, 210L, 210L, 210L, 211L,
211L, 211L, 212L, 212L, 212L, 213L, 213L, 213L, 214L, 214L, 214L,
215L, 215L, 215L, 216L, 216L, 216L, 217L, 217L, 217L, 218L, 218L,
218L, 219L, 219L, 219L, 220L, 220L, 220L, 221L, 221L, 221L, 222L,
222L, 222L, 223L, 223L, 223L, 224L, 224L, 224L, 225L, 225L, 225L,
226L, 226L, 226L, 227L, 227L, 227L, 228L, 228L, 228L, 229L, 229L,
229L, 230L, 230L, 230L, 231L, 231L, 231L, 232L, 232L, 232L, 233L,
233L, 233L, 234L, 234L, 234L, 235L, 235L, 235L, 236L, 236L, 236L,
237L, 237L, 237L, 238L, 238L, 238L, 239L, 239L, 239L, 240L, 240L,
240L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 10L, 10L, 11L,
11L, 11L, 12L, 12L, 12L, 13L, 13L, 13L, 14L, 14L, 14L, 15L, 15L,
15L, 16L, 16L, 16L, 17L, 17L, 17L, 18L, 18L, 18L, 19L, 19L, 19L,
20L, 20L, 20L, 21L, 21L, 21L, 22L, 22L, 22L, 23L, 23L, 23L, 24L,
24L, 24L, 25L, 25L, 25L, 26L, 26L, 26L, 27L, 27L, 27L, 28L, 28L,
28L, 29L, 29L, 29L, 30L, 30L, 30L, 31L, 31L, 31L, 32L, 32L, 32L,
33L, 33L, 33L, 34L, 34L, 34L, 35L, 35L, 35L, 36L, 36L, 36L, 37L,
37L, 37L, 38L, 38L, 38L, 39L, 39L, 39L, 40L, 40L, 40L, 41L, 41L,
41L, 42L, 42L, 42L, 43L, 43L, 43L, 44L, 44L, 44L, 45L, 45L, 45L,
46L, 46L, 46L, 47L, 47L, 47L, 48L, 48L, 48L, 49L, 49L, 49L, 50L,
50L, 50L, 51L, 51L, 51L, 52L, 52L, 52L, 53L, 53L, 53L, 54L, 54L,
54L, 55L, 55L, 55L, 56L, 56L, 56L, 57L, 57L, 57L, 58L, 58L, 58L,
59L, 59L, 59L, 60L, 60L, 60L, 61L, 61L, 61L, 62L, 62L, 62L, 63L,
63L, 63L, 64L, 64L, 64L, 65L, 65L, 65L, 66L, 66L, 66L, 67L, 67L,
67L, 68L, 68L, 68L, 69L, 69L, 69L, 70L, 70L, 70L, 71L, 71L, 71L,
72L, 72L, 72L, 73L, 73L, 73L, 74L, 74L, 74L, 75L, 75L, 75L, 76L,
76L, 76L, 77L, 77L, 77L, 78L, 78L, 78L, 79L, 79L, 79L, 80L, 80L,
80L, 81L, 81L, 81L, 82L, 82L, 82L, 83L, 83L, 83L, 84L, 84L, 84L,
85L, 85L, 85L, 86L, 86L, 86L, 87L, 87L, 87L, 88L, 88L, 88L, 89L,
89L, 89L, 90L, 90L, 90L, 91L, 91L, 91L, 92L, 92L, 92L, 93L, 93L,
93L, 94L, 94L, 94L, 95L, 95L, 95L, 96L, 96L, 96L, 97L, 97L, 97L,
98L, 98L, 98L, 99L, 99L, 99L, 100L, 100L, 100L, 101L, 101L, 101L,
102L, 102L, 102L, 103L, 103L, 103L, 104L, 104L, 104L, 105L, 105L,
105L, 106L, 106L, 106L, 107L, 107L, 107L, 108L, 108L, 108L, 109L,
109L, 109L, 110L, 110L, 110L, 111L, 111L, 111L, 112L, 112L, 112L,
113L, 113L, 113L, 114L, 114L, 114L, 115L, 115L, 115L, 116L, 116L,
116L, 117L, 117L, 117L, 118L, 118L, 118L, 119L, 119L, 119L, 120L,
120L, 120L, 121L, 121L, 121L, 122L, 122L, 122L, 123L, 123L, 123L,
124L, 124L, 124L, 125L, 125L, 125L, 126L, 126L, 126L, 127L, 127L,
127L, 128L, 128L, 128L, 129L, 129L, 129L, 130L, 130L, 130L, 131L,
131L, 131L, 132L, 132L, 132L, 151L, 151L, 151L, 152L, 152L, 152L,
153L, 153L, 153L, 154L, 154L, 154L, 155L, 155L, 155L, 156L, 156L,
156L, 157L, 157L, 157L, 158L, 158L, 158L, 159L, 159L, 159L, 160L,
160L, 160L, 161L, 161L, 161L, 162L, 162L, 162L, 163L, 163L, 163L,
164L, 164L, 164L, 165L, 165L, 165L, 166L, 166L, 166L, 167L, 167L,
167L, 168L, 168L, 168L, 169L, 169L, 169L, 170L, 170L, 170L, 171L,
171L, 171L, 172L, 172L, 172L, 173L, 173L, 173L, 174L, 174L, 174L,
175L, 175L, 175L, 176L, 176L, 176L, 177L, 177L, 177L, 178L, 178L,
178L, 179L, 179L, 179L, 180L, 180L, 180L, 181L, 181L, 181L, 182L,
182L, 182L, 183L, 183L, 183L, 184L, 184L, 184L, 185L, 185L, 185L,
186L, 186L, 186L, 187L, 187L, 187L, 188L, 188L, 188L, 189L, 189L,
189L, 190L, 190L, 190L, 191L, 191L, 191L, 192L, 192L, 192L, 133L,
133L, 133L, 134L, 134L, 134L, 135L, 135L, 135L, 136L, 136L, 136L,
137L, 137L, 137L, 138L, 138L, 138L, 139L, 139L, 139L, 140L, 140L,
140L, 141L, 141L, 141L, 142L, 142L, 142L, 143L, 143L, 143L, 144L,
144L, 144L, 241L, 241L, 241L, 242L, 242L, 242L, 243L, 243L, 243L,
244L, 244L, 244L, 245L, 245L, 245L, 246L, 246L, 246L, 385L, 385L,
385L, 386L, 386L, 386L, 387L, 387L, 387L, 388L, 388L, 388L, 389L,
389L, 389L, 390L, 390L, 390L, 433L, 433L, 433L, 434L, 434L, 434L,
435L, 435L, 435L, 436L, 436L, 436L, 437L, 437L, 437L, 438L, 438L,
438L, 439L, 439L, 439L, 440L, 440L, 440L, 441L, 441L, 441L, 442L,
442L, 442L, 443L, 443L, 443L, 444L, 444L, 444L, 445L, 445L, 445L,
446L, 446L, 446L, 447L, 447L, 447L, 448L, 448L, 448L, 449L, 449L,
449L, 450L, 450L, 450L, 451L, 451L, 451L, 452L, 452L, 452L, 453L,
453L, 453L, 454L, 454L, 454L, 455L, 455L, 455L, 456L, 456L, 456L,
457L, 457L, 457L, 458L, 458L, 458L, 459L, 459L, 459L, 460L, 460L,
460L, 461L, 461L, 461L, 462L, 462L, 462L, 463L, 463L, 463L, 464L,
464L, 464L, 465L, 465L, 465L, 466L, 466L, 466L, 467L, 467L, 467L,
468L, 468L, 468L, 469L, 469L, 469L, 470L, 470L, 470L, 471L, 471L,
471L, 472L, 472L, 472L, 473L, 473L, 473L, 474L, 474L, 474L, 475L,
475L, 475L, 476L, 476L, 476L, 477L, 477L, 477L, 478L, 478L, 478L,
479L, 479L, 479L, 480L, 480L, 480L, 247L, 247L, 247L, 248L, 248L,
248L, 249L, 249L, 249L, 250L, 250L, 250L, 251L, 251L, 251L, 252L,
252L, 252L, 253L, 253L, 253L, 254L, 254L, 254L, 255L, 255L, 255L,
256L, 256L, 256L, 257L, 257L, 257L, 258L, 258L, 258L, 259L, 259L,
259L, 260L, 260L, 260L, 261L, 261L, 261L, 262L, 262L, 262L, 263L,
263L, 263L, 264L, 264L, 264L, 265L, 265L, 265L, 266L, 266L, 266L,
267L, 267L, 267L, 268L, 268L, 268L, 269L, 269L, 269L, 270L, 270L,
270L, 271L, 271L, 271L, 272L, 272L, 272L, 273L, 273L, 273L, 274L,
274L, 274L, 275L, 275L, 275L, 276L, 276L, 276L, 277L, 277L, 277L,
278L, 278L, 278L, 279L, 279L, 279L, 280L, 280L, 280L, 281L, 281L,
281L, 282L, 282L, 282L, 283L, 283L, 283L, 284L, 284L, 284L, 285L,
285L, 285L, 286L, 286L, 286L, 287L, 287L, 287L, 288L, 288L, 288L,
289L, 289L, 289L, 290L, 290L, 290L, 291L, 291L, 291L, 292L, 292L,
292L, 293L, 293L, 293L, 294L, 294L, 294L, 295L, 295L, 295L, 296L,
296L, 296L, 297L, 297L, 297L, 298L, 298L, 298L, 299L, 299L, 299L,
300L, 300L, 300L, 301L, 301L, 301L, 302L, 302L, 302L, 303L, 303L,
303L, 304L, 304L, 304L, 305L, 305L, 305L, 306L, 306L, 306L, 307L,
307L, 307L, 308L, 308L, 308L, 309L, 309L, 309L, 310L, 310L, 310L,
311L, 311L, 311L, 312L, 312L, 312L, 319L, 319L, 319L, 320L, 320L,
320L, 321L, 321L, 321L, 322L, 322L, 322L, 323L, 323L, 323L, 324L,
324L, 324L, 325L, 325L, 325L, 326L, 326L, 326L, 327L, 327L, 327L,
328L, 328L, 328L, 329L, 329L, 329L, 330L, 330L, 330L, 331L, 331L,
331L, 332L, 332L, 332L, 333L, 333L, 333L, 334L, 334L, 334L, 335L,
335L, 335L, 336L, 336L, 336L, 337L, 337L, 337L, 338L, 338L, 338L,
339L, 339L, 339L, 340L, 340L, 340L, 341L, 341L, 341L, 342L, 342L,
342L, 343L, 343L, 343L, 344L, 344L, 344L, 345L, 345L, 345L, 346L,
346L, 346L, 347L, 347L, 347L, 348L, 348L, 348L, 349L, 349L, 349L,
350L, 350L, 350L, 351L, 351L, 351L, 352L, 352L, 352L, 353L, 353L,
353L, 354L, 354L, 354L, 355L, 355L, 355L, 356L, 356L, 356L, 357L,
357L, 357L, 358L, 358L, 358L, 359L, 359L, 359L, 360L, 360L, 360L,
361L, 361L, 361L, 362L, 362L, 362L, 363L, 363L, 363L, 364L, 364L,
364L, 365L, 365L, 365L, 366L, 366L, 366L, 367L, 367L, 367L, 368L,
368L, 368L, 369L, 369L, 369L, 370L, 370L, 370L, 371L, 371L, 371L,
372L, 372L, 372L, 391L, 391L, 391L, 392L, 392L, 392L, 393L, 393L,
393L, 394L, 394L, 394L, 395L, 395L, 395L, 396L, 396L, 396L, 397L,
397L, 397L, 398L, 398L, 398L, 399L, 399L, 399L, 400L, 400L, 400L,
401L, 401L, 401L, 402L, 402L, 402L, 403L, 403L, 403L, 404L, 404L,
404L, 405L, 405L, 405L, 406L, 406L, 406L, 407L, 407L, 407L, 408L,
408L, 408L, 409L, 409L, 409L, 410L, 410L, 410L, 411L, 411L, 411L,
412L, 412L, 412L, 413L, 413L, 413L, 414L, 414L, 414L, 415L, 415L,
415L, 416L, 416L, 416L, 417L, 417L, 417L, 418L, 418L, 418L, 419L,
419L, 419L, 420L, 420L, 420L, 421L, 421L, 421L, 422L, 422L, 422L,
423L, 423L, 423L, 424L, 424L, 424L, 425L, 425L, 425L, 426L, 426L,
426L, 427L, 427L, 427L, 428L, 428L, 428L, 429L, 429L, 429L, 430L,
430L, 430L, 431L, 431L, 431L, 432L, 432L, 432L, 373L, 373L, 373L,
374L, 374L, 374L, 375L, 375L, 375L, 376L, 376L, 376L, 377L, 377L,
377L, 378L, 378L, 378L, 379L, 379L, 379L, 380L, 380L, 380L, 381L,
381L, 381L, 382L, 382L, 382L, 383L, 383L, 383L, 384L, 384L, 384L,
313L, 313L, 313L, 314L, 314L, 314L, 315L, 315L, 315L, 316L, 316L,
316L, 317L, 317L, 317L, 318L, 318L, 318L), .Label = c("CUR:0:L1",
"CUR:0:L2", "CUR:0:L3", "CUR:0:L4", "CUR:0:L5", "CUR:0:L6", "CUR:00A:L1",
"CUR:00A:L2", "CUR:00A:L3", "CUR:00A:L4", "CUR:00A:L5", "CUR:00A:L6",
"CUR:00B:L1", "CUR:00B:L2", "CUR:00B:L3", "CUR:00B:L4", "CUR:00B:L5",
"CUR:00B:L6", "CUR:00C:L1", "CUR:00C:L2", "CUR:00C:L3", "CUR:00C:L4",
"CUR:00C:L5", "CUR:00C:L6", "CUR:00D:L1", "CUR:00D:L2", "CUR:00D:L3",
"CUR:00D:L4", "CUR:00D:L5", "CUR:00D:L6", "CUR:00F:L1", "CUR:00F:L2",
"CUR:00F:L3", "CUR:00F:L4", "CUR:00F:L5", "CUR:00F:L6", "CUR:00H:L1",
"CUR:00H:L2", "CUR:00H:L3", "CUR:00H:L4", "CUR:00H:L5", "CUR:00H:L6",
"CUR:00I:L1", "CUR:00I:L2", "CUR:00I:L3", "CUR:00I:L4", "CUR:00I:L5",
"CUR:00I:L6", "CUR:00J:L1", "CUR:00J:L2", "CUR:00J:L3", "CUR:00J:L4",
"CUR:00J:L5", "CUR:00J:L6", "CUR:00K:L1", "CUR:00K:L2", "CUR:00K:L3",
"CUR:00K:L4", "CUR:00K:L5", "CUR:00K:L6", "CUR:00L:L1", "CUR:00L:L2",
"CUR:00L:L3", "CUR:00L:L4", "CUR:00L:L5", "CUR:00L:L6", "CUR:00N:L1",
"CUR:00N:L2", "CUR:00N:L3", "CUR:00N:L4", "CUR:00N:L5", "CUR:00N:L6",
"CUR:00O:L1", "CUR:00O:L2", "CUR:00O:L3", "CUR:00O:L4", "CUR:00O:L5",
"CUR:00O:L6", "CUR:00P:L1", "CUR:00P:L2", "CUR:00P:L3", "CUR:00P:L4",
"CUR:00P:L5", "CUR:00P:L6", "CUR:00Q:L1", "CUR:00Q:L2", "CUR:00Q:L3",
"CUR:00Q:L4", "CUR:00Q:L5", "CUR:00Q:L6", "CUR:00R:L1", "CUR:00R:L2",
"CUR:00R:L3", "CUR:00R:L4", "CUR:00R:L5", "CUR:00R:L6", "CUR:00T:L1",
"CUR:00T:L2", "CUR:00T:L3", "CUR:00T:L4", "CUR:00T:L5", "CUR:00T:L6",
"CUR:00U:L1", "CUR:00U:L2", "CUR:00U:L3", "CUR:00U:L4", "CUR:00U:L5",
"CUR:00U:L6", "CUR:00V:L1", "CUR:00V:L2", "CUR:00V:L3", "CUR:00V:L4",
"CUR:00V:L5", "CUR:00V:L6", "CUR:00W:L1", "CUR:00W:L2", "CUR:00W:L3",
"CUR:00W:L4", "CUR:00W:L5", "CUR:00W:L6", "CUR:00X:L1", "CUR:00X:L2",
"CUR:00X:L3", "CUR:00X:L4", "CUR:00X:L5", "CUR:00X:L6", "CUR:00Z:L1",
"CUR:00Z:L2", "CUR:00Z:L3", "CUR:00Z:L4", "CUR:00Z:L5", "CUR:00Z:L6",
"CUR:01A:L1", "CUR:01A:L2", "CUR:01A:L3", "CUR:01A:L4", "CUR:01A:L5",
"CUR:01A:L6", "CUR:01B:L1", "CUR:01B:L2", "CUR:01B:L3", "CUR:01B:L4",
"CUR:01B:L5", "CUR:01B:L6", "CUR:1:L1", "CUR:1:L2", "CUR:1:L3",
"CUR:1:L4", "CUR:1:L5", "CUR:1:L6", "CUR:10:L1", "CUR:10:L2",
"CUR:10:L3", "CUR:10:L4", "CUR:10:L5", "CUR:10:L6", "CUR:11:L1",
"CUR:11:L2", "CUR:11:L3", "CUR:11:L4", "CUR:11:L5", "CUR:11:L6",
"CUR:12:L1", "CUR:12:L2", "CUR:12:L3", "CUR:12:L4", "CUR:12:L5",
"CUR:12:L6", "CUR:13:L1", "CUR:13:L2", "CUR:13:L3", "CUR:13:L4",
"CUR:13:L5", "CUR:13:L6", "CUR:16:L1", "CUR:16:L2", "CUR:16:L3",
"CUR:16:L4", "CUR:16:L5", "CUR:16:L6", "CUR:18:L1", "CUR:18:L2",
"CUR:18:L3", "CUR:18:L4", "CUR:18:L5", "CUR:18:L6", "CUR:19:L1",
"CUR:19:L2", "CUR:19:L3", "CUR:19:L4", "CUR:19:L5", "CUR:19:L6",
"CUR:2:L1", "CUR:2:L2", "CUR:2:L3", "CUR:2:L4", "CUR:2:L5", "CUR:2:L6",
"CUR:3:L1", "CUR:3:L2", "CUR:3:L3", "CUR:3:L4", "CUR:3:L5", "CUR:3:L6",
"CUR:4:L1", "CUR:4:L2", "CUR:4:L3", "CUR:4:L4", "CUR:4:L5", "CUR:4:L6",
"CUR:5:L1", "CUR:5:L2", "CUR:5:L3", "CUR:5:L4", "CUR:5:L5", "CUR:5:L6",
"CUR:6:L1", "CUR:6:L2", "CUR:6:L3", "CUR:6:L4", "CUR:6:L5", "CUR:6:L6",
"CUR:7:L1", "CUR:7:L2", "CUR:7:L3", "CUR:7:L4", "CUR:7:L5", "CUR:7:L6",
"CUR:8:L1", "CUR:8:L2", "CUR:8:L3", "CUR:8:L4", "CUR:8:L5", "CUR:8:L6",
"CUR:9:L1", "CUR:9:L2", "CUR:9:L3", "CUR:9:L4", "CUR:9:L5", "CUR:9:L6",
"PRI:0:L1", "PRI:0:L2", "PRI:0:L3", "PRI:0:L4", "PRI:0:L5", "PRI:0:L6",
"PRI:00A:L1", "PRI:00A:L2", "PRI:00A:L3", "PRI:00A:L4", "PRI:00A:L5",
"PRI:00A:L6", "PRI:00B:L1", "PRI:00B:L2", "PRI:00B:L3", "PRI:00B:L4",
"PRI:00B:L5", "PRI:00B:L6", "PRI:00C:L1", "PRI:00C:L2", "PRI:00C:L3",
"PRI:00C:L4", "PRI:00C:L5", "PRI:00C:L6", "PRI:00D:L1", "PRI:00D:L2",
"PRI:00D:L3", "PRI:00D:L4", "PRI:00D:L5", "PRI:00D:L6", "PRI:00F:L1",
"PRI:00F:L2", "PRI:00F:L3", "PRI:00F:L4", "PRI:00F:L5", "PRI:00F:L6",
"PRI:00H:L1", "PRI:00H:L2", "PRI:00H:L3", "PRI:00H:L4", "PRI:00H:L5",
"PRI:00H:L6", "PRI:00I:L1", "PRI:00I:L2", "PRI:00I:L3", "PRI:00I:L4",
"PRI:00I:L5", "PRI:00I:L6", "PRI:00J:L1", "PRI:00J:L2", "PRI:00J:L3",
"PRI:00J:L4", "PRI:00J:L5", "PRI:00J:L6", "PRI:00K:L1", "PRI:00K:L2",
"PRI:00K:L3", "PRI:00K:L4", "PRI:00K:L5", "PRI:00K:L6", "PRI:00L:L1",
"PRI:00L:L2", "PRI:00L:L3", "PRI:00L:L4", "PRI:00L:L5", "PRI:00L:L6",
"PRI:00N:L1", "PRI:00N:L2", "PRI:00N:L3", "PRI:00N:L4", "PRI:00N:L5",
"PRI:00N:L6", "PRI:00O:L1", "PRI:00O:L2", "PRI:00O:L3", "PRI:00O:L4",
"PRI:00O:L5", "PRI:00O:L6", "PRI:00P:L1", "PRI:00P:L2", "PRI:00P:L3",
"PRI:00P:L4", "PRI:00P:L5", "PRI:00P:L6", "PRI:00Q:L1", "PRI:00Q:L2",
"PRI:00Q:L3", "PRI:00Q:L4", "PRI:00Q:L5", "PRI:00Q:L6", "PRI:00R:L1",
"PRI:00R:L2", "PRI:00R:L3", "PRI:00R:L4", "PRI:00R:L5", "PRI:00R:L6",
"PRI:00T:L1", "PRI:00T:L2", "PRI:00T:L3", "PRI:00T:L4", "PRI:00T:L5",
"PRI:00T:L6", "PRI:00U:L1", "PRI:00U:L2", "PRI:00U:L3", "PRI:00U:L4",
"PRI:00U:L5", "PRI:00U:L6", "PRI:00V:L1", "PRI:00V:L2", "PRI:00V:L3",
"PRI:00V:L4", "PRI:00V:L5", "PRI:00V:L6", "PRI:00W:L1", "PRI:00W:L2",
"PRI:00W:L3", "PRI:00W:L4", "PRI:00W:L5", "PRI:00W:L6", "PRI:00X:L1",
"PRI:00X:L2", "PRI:00X:L3", "PRI:00X:L4", "PRI:00X:L5", "PRI:00X:L6",
"PRI:00Z:L1", "PRI:00Z:L2", "PRI:00Z:L3", "PRI:00Z:L4", "PRI:00Z:L5",
"PRI:00Z:L6", "PRI:01A:L1", "PRI:01A:L2", "PRI:01A:L3", "PRI:01A:L4",
"PRI:01A:L5", "PRI:01A:L6", "PRI:01B:L1", "PRI:01B:L2", "PRI:01B:L3",
"PRI:01B:L4", "PRI:01B:L5", "PRI:01B:L6", "PRI:1:L1", "PRI:1:L2",
"PRI:1:L3", "PRI:1:L4", "PRI:1:L5", "PRI:1:L6", "PRI:10:L1",
"PRI:10:L2", "PRI:10:L3", "PRI:10:L4", "PRI:10:L5", "PRI:10:L6",
"PRI:11:L1", "PRI:11:L2", "PRI:11:L3", "PRI:11:L4", "PRI:11:L5",
"PRI:11:L6", "PRI:12:L1", "PRI:12:L2", "PRI:12:L3", "PRI:12:L4",
"PRI:12:L5", "PRI:12:L6", "PRI:13:L1", "PRI:13:L2", "PRI:13:L3",
"PRI:13:L4", "PRI:13:L5", "PRI:13:L6", "PRI:16:L1", "PRI:16:L2",
"PRI:16:L3", "PRI:16:L4", "PRI:16:L5", "PRI:16:L6", "PRI:18:L1",
"PRI:18:L2", "PRI:18:L3", "PRI:18:L4", "PRI:18:L5", "PRI:18:L6",
"PRI:19:L1", "PRI:19:L2", "PRI:19:L3", "PRI:19:L4", "PRI:19:L5",
"PRI:19:L6", "PRI:2:L1", "PRI:2:L2", "PRI:2:L3", "PRI:2:L4",
"PRI:2:L5", "PRI:2:L6", "PRI:3:L1", "PRI:3:L2", "PRI:3:L3", "PRI:3:L4",
"PRI:3:L5", "PRI:3:L6", "PRI:4:L1", "PRI:4:L2", "PRI:4:L3", "PRI:4:L4",
"PRI:4:L5", "PRI:4:L6", "PRI:5:L1", "PRI:5:L2", "PRI:5:L3", "PRI:5:L4",
"PRI:5:L5", "PRI:5:L6", "PRI:6:L1", "PRI:6:L2", "PRI:6:L3", "PRI:6:L4",
"PRI:6:L5", "PRI:6:L6", "PRI:7:L1", "PRI:7:L2", "PRI:7:L3", "PRI:7:L4",
"PRI:7:L5", "PRI:7:L6", "PRI:8:L1", "PRI:8:L2", "PRI:8:L3", "PRI:8:L4",
"PRI:8:L5", "PRI:8:L6", "PRI:9:L1", "PRI:9:L2", "PRI:9:L3", "PRI:9:L4",
"PRI:9:L5", "PRI:9:L6"), class = "factor")
I wanted to use caret to partition my data, so this is what I did:
library(caret)
train.rows<- createDataPartition(gg, p=0.7,list = FALSE)
> length(train.rows)
[1] 1440
However, I am getting everything in gg in my train.rows even after 0.7 partitioning. What am I missing here?
Try it without class = factor
Then your partitioned vector will be:
indexes <- caret::createDataPartition(gg, times = 1, p = 0.7, list=FALSE)
train <- gg[indexes]
test <- gg[-indexes]
I have two datasets with ellipses centroids coordinates (X & Y), Areas, Major and Minor axes (and other variables). My aim is to calculate the overlap between the groups of ellipses and plot them.
The main question is regarding calculations of overlapping regions.
For plotting I would use draw.ellipse function but I'm open to other alternatives.
The two datasets are very similar, here's a subset of one of the two datasets.
dput(slide0[,2:5])
structure(list(Area = c(15453600L, 89L, 151L, 80L, 72L, 126L,
228L, 140L, 192L, 180L, 226L, 96L, 128L, 214L, 176L, 102L, 180L,
229L, 326L, 148L, 86L, 151L, 148L, 255L, 102L, 226L, 224L, 207L,
136L, 115L, 133L, 199L, 124L, 268L, 172L, 207L, 128L, 216L, 136L,
292L, 232L, 79L, 107L, 190L, 104L, 190L, 226L, 136L, 102L, 148L,
130L, 138L, 180L, 200L, 130L, 177L, 183L, 164L, 140L, 292L, 180L,
161L, 79L, 161L, 80L, 207L, 140L, 151L, 190L, 112L, 208L, 207L,
293L, 146L, 116L, 364L, 238L, 154L, 400L, 190L, 208L, 240L, 158L,
98L, 107L, 133L, 217L, 86L, 112L, 86L, 96L, 138L, 224L, 220L,
102L, 154L, 200L, 158L, 190L, 375L, 281L, 604L, 304L, 346L, 186L,
320L, 454L, 200L, 194L, 281L, 247L, 176L, 148L, 252L, 88L, 208L,
236L, 268L, 238L, 262L, 130L, 130L, 160L, 164L, 186L, 186L, 424L,
364L, 192L, 136L, 247L, 148L, 214L, 236L, 560L, 376L, 104L, 180L,
300L, 70L, 343L, 420L, 389L, 84L, 248L, 314L, 302L, 144L, 60L,
88L, 107L, 95L, 116L, 89L, 62L, 124L, 115L, 72L, 140L, 330L,
762L, 931L, 390L, 298L, 256L, 288L, 52L, 48L, 122L, 247L, 88L,
299L, 324L, 96L, 121L, 52L, 70L, 97L, 758L, 112L, 234L, 147L,
75L, 80L, 96L, 84L, 97L, 36L, 44L, 79L, 40L, 121L, 48L, 79L,
54L, 52L, 61L, 52L, 89L, 92L, 200L, 60L, 156L, 64L, 72L, 200L,
48L, 44L, 136L, 136L, 112L, 84L, 98L, 84L, 58L, 42L, 48L, 70L,
54L, 104L, 75L, 80L, 88L, 37L, 95L, 160L, 79L, 137L, 138L, 172L,
80L, 32L, 148L, 314L, 180L, 236L, 234L, 72L, 124L, 121L, 164L,
255L, 207L, 122L, 414L, 254L, 85L, 133L, 80L, 151L, 102L, 61L,
147L, 220L, 192L, 340L, 200L, 133L, 164L, 136L, 136L, 140L, 281L,
208L, 400L, 112L, 96L, 240L, 234L, 136L, 80L, 177L, 130L, 207L,
121L, 248L, 104L, 88L, 192L, 200L, 359L, 276L, 84L, 96L, 177L,
214L, 104L, 92L, 102L, 147L, 136L, 208L, 281L, 112L, 151L, 146L,
161L, 96L, 21L, 44L, 82L, 124L, 92L, 64L, 84L, 97L, 98L, 16L,
60L, 115L, 126L, 60L, 75L, 80L, 86L, 84L, 89L, 96L, 82L, 72L,
200L, 80L, 70L, 79L, 80L, 177L, 44L, 79L, 122L, 75L, 104L, 84L,
158L, 139L, 146L, 69L, 281L, 448L, 68L, 170L, 115L, 236L, 244L,
97L, 104L, 84L, 70L, 70L, 96L, 68L, 96L, 70L, 89L, 380L, 44L,
122L, 320L, 556L, 140L, 208L, 288L, 225L, 302L, 304L, 180L, 210L,
160L, 194L, 151L, 172L, 320L, 256L, 208L, 341L, 346L, 107L, 98L,
51L, 79L, 292L, 229L, 192L, 484L, 176L, 146L, 115L, 89L, 69L,
151L, 72L, 651L, 512L, 384L, 124L, 128L, 82L, 128L, 124L, 121L,
72L, 398L, 190L, 354L, 182L, 228L, 531L, 354L, 236L, 298L, 238L,
638L, 400L, 247L, 166L, 210L, 156L, 224L, 264L, 89L, 228L, 254L,
181L, 247L, 200L, 310L, 238L, 177L, 144L, 133L, 340L, 311L, 146L,
322L, 220L, 190L, 398L, 166L, 228L, 161L, 137L, 128L, 86L, 104L,
42L, 116L, 60L, 192L, 398L, 264L, 255L, 447L, 244L, 324L, 182L,
247L, 383L, 292L, 484L, 760L, 550L, 740L, 884L, 414L, 400L, 344L,
416L, 380L, 476L, 298L, 154L, 82L, 199L, 767L, 228L, 420L, 238L,
146L, 176L, 326L, 273L, 126L, 104L, 166L, 266L, 226L, 76L, 133L,
256L, 136L, 61L, 314L, 144L, 260L, 200L, 147L, 356L, 540L, 239L,
200L, 186L, 217L, 69L, 208L, 346L, 382L, 207L, 300L, 140L, 161L,
398L, 176L, 228L, 112L, 160L, 266L, 190L, 254L, 84L, 732L, 224L,
532L, 244L, 384L, 255L, 369L, 432L, 216L, 288L, 236L, 207L, 302L,
232L, 151L, 86L, 124L, 44L, 128L, 124L, 292L, 102L, 144L, 92L,
225L, 293L, 266L, 549L, 284L, 144L, 254L, 136L, 186L, 180L, 164L,
166L, 146L, 200L, 236L, 186L, 148L, 154L, 226L, 158L, 140L, 160L,
136L, 102L, 341L, 253L, 121L, 121L, 340L, 224L, 148L, 216L, 220L,
366L, 188L, 154L, 228L, 236L, 208L, 240L, 324L, 172L, 302L, 164L,
420L, 254L, 88L, 224L, 210L, 124L, 264L, 315L, 332L, 190L, 128L,
130L, 220L, 166L, 107L, 112L, 158L, 116L, 98L, 147L, 192L, 186L,
112L, 210L, 84L, 256L, 274L, 200L, 192L, 192L, 170L, 107L, 302L,
244L, 299L, 170L, 115L, 186L, 208L, 156L, 216L, 220L, 332L, 451L,
340L, 210L, 128L, 176L, 456L, 128L, 495L, 194L, 316L, 236L, 199L,
870L, 248L, 172L, 192L, 240L, 200L, 192L, 208L, 126L, 344L, 384L,
420L, 176L, 167L, 128L, 86L, 151L, 96L, 104L, 200L, 208L, 72L,
176L, 116L, 192L, 79L, 96L, 328L, 568L, 302L, 229L, 130L, 354L,
89L, 84L, 112L, 160L, 92L, 217L, 341L, 240L, 369L, 268L, 136L,
324L, 192L, 326L, 89L, 146L, 158L, 194L, 214L, 161L, 96L, 172L,
136L, 172L, 240L, 180L, 108L, 524L, 102L, 138L, 166L, 146L, 177L,
137L, 140L, 140L, 274L, 576L, 264L, 86L, 225L, 396L, 239L, 434L,
782L, 322L, 112L, 80L, 200L, 136L, 144L, 238L, 96L, 130L, 86L,
102L, 92L, 356L, 255L, 264L, 288L, 140L, 299L, 264L, 299L, 186L,
146L, 383L, 214L, 375L, 186L, 273L, 284L, 122L, 284L, 72L, 79L,
292L, 192L, 396L, 276L, 228L, 260L, 172L, 172L, 107L, 80L, 104L,
98L, 186L, 226L, 104L, 180L, 85L, 144L, 120L, 248L, 315L, 151L,
166L, 236L, 136L, 540L, 341L, 200L, 226L, 208L, 112L, 160L, 96L,
260L, 262L, 130L, 177L, 116L, 98L, 112L, 208L, 239L, 176L, 151L,
186L, 130L, 177L, 172L, 122L, 183L, 133L, 248L, 146L, 217L, 746L,
199L, 224L, 225L, 140L, 172L, 244L, 274L, 158L, 136L, 344L, 172L,
82L, 200L, 70L, 95L, 239L, 176L, 180L, 147L, 116L, 89L, 79L,
89L, 112L, 240L, 200L, 326L, 84L, 264L, 266L, 266L, 262L, 247L,
164L, 217L, 210L, 122L, 214L, 316L, 217L, 364L, 192L, 660L, 764L,
584L, 228L, 498L, 314L, 188L, 130L, 166L, 255L, 477L, 200L, 816L,
176L, 247L, 252L, 126L, 100L), Mean = c(175.038, 100.18, 99.781,
116.9, 108.375, 94.373, 105.987, 102.993, 90.74, 114.856, 99.412,
123.5, 99.008, 146.168, 88.818, 99.814, 87.244, 68.223, 86.868,
96.189, 133.523, 119.159, 137.311, 109.8, 102.98, 95.407, 112.612,
106.957, 147.382, 76.904, 101.774, 67.02, 118.984, 85.851, 77.355,
91.894, 91.773, 67.833, 103.397, 110.363, 124.513, 112.595, 123.794,
87.847, 88.058, 102.268, 105.354, 89.184, 141.618, 151.291, 135.746,
86.283, 87.389, 102.32, 106.592, 90.153, 100.055, 84.701, 93.264,
97.586, 99.317, 88.05, 94.038, 99.665, 89.763, 100.072, 82.714,
116.325, 102.879, 102.911, 90.317, 92.217, 99.594, 72.425, 91.336,
90.514, 96.197, 103.89, 106.513, 103.647, 98.216, 98.338, 122.513,
104.49, 114.467, 121.278, 109.327, 97.616, 93.223, 98.767, 132.302,
91.964, 86.58, 85.559, 98.5, 90.643, 87.21, 79.715, 90.995, 73.584,
96.153, 118.086, 112.441, 118.208, 115.199, 143.731, 132.555,
128.76, 79.83, 106.466, 83.142, 88.091, 94.243, 110.254, 118.489,
97.24, 74.771, 117, 89.706, 96.08, 93.846, 105.515, 102.225,
120.75, 97.828, 109.059, 102.245, 106.357, 97.891, 114.566, 92.344,
100.858, 130.467, 114.619, 133.125, 147.027, 95.673, 108.178,
104.57, 108.214, 123.924, 110.233, 115.861, 124.905, 106.996,
81.987, 93.914, 111.611, 118.7, 138.432, 150.972, 156.842, 163.371,
102.764, 141.629, 136.694, 163.287, 133.194, 104.5, 113.645,
149.705, 127.354, 91.405, 152.614, 148.102, 148.295, 151.462,
175.646, 148.139, 153.636, 159.909, 173.027, 131.5, 167.656,
176.066, 147.385, 108.643, 139.732, 105.799, 130.384, 131.346,
115.776, 110.573, 124.5, 126.167, 157.393, 107.66, 104.5, 113.75,
114.354, 97.825, 115.091, 104.521, 91.316, 103.056, 97.788, 118.361,
126.5, 114.629, 130.413, 120.07, 119.083, 139.359, 117.75, 99.583,
92.68, 128.667, 112.727, 105.206, 115.838, 112.946, 81.69, 139.439,
120.131, 152.517, 140.024, 165.854, 147.943, 137.944, 149.625,
154.4, 139.625, 135.58, 169.405, 97.253, 104.8, 109.215, 97.299,
117.406, 110.953, 107.138, 125.938, 72.791, 142.236, 121.117,
127.542, 118.175, 128.278, 132.556, 127.116, 132.098, 120.69,
140.57, 114.943, 142.087, 136.551, 153.835, 157.098, 159.688,
91.841, 119, 122.82, 135.707, 125.764, 115.781, 112.762, 139.22,
126.759, 125.378, 116.353, 122.706, 123.086, 90.249, 101.139,
128.018, 71.812, 83.365, 101.421, 108.568, 113.36, 120.787, 136.712,
136.908, 118.826, 96.091, 65.258, 80.337, 81.307, 99.708, 79.43,
110.613, 133.293, 119.548, 120.531, 145.672, 152.551, 112.212,
99.511, 174.431, 124.639, 96.213, 96.519, 73.313, 95.089, 107.768,
83.267, 61.609, 75.427, 71.286, 71.432, 46.537, 45.476, 43.022,
62.453, 57.119, 70.371, 51.357, 61.375, 83.333, 82.426, 79.96,
116.067, 105.707, 87.325, 112.895, 109.095, 117.281, 111.854,
148.683, 133.125, 104.845, 127.963, 137.671, 138.911, 140.825,
81.808, 96.727, 105.228, 97.221, 111.427, 132.558, 128.643, 81.949,
80.36, 92.705, 118.899, 144.306, 74.203, 143.779, 101.706, 97.2,
112.246, 128.369, 138.031, 120.625, 89.94, 106.357, 128.086,
123.375, 131.397, 150.083, 132.829, 145.618, 91.547, 116.659,
106.016, 112.1, 130.752, 116.714, 109.788, 123.153, 88.089, 87.811,
76.714, 105.028, 116.762, 110.763, 86.912, 124.126, 113.262,
100.559, 82.238, 100.933, 84.739, 88.28, 103.925, 123.255, 131.902,
101.19, 91.973, 133.035, 145.464, 138.7, 114.074, 141.062, 149.383,
153.36, 154.899, 157.742, 150.806, 136.886, 148.42, 161.966,
128.024, 154.977, 156.037, 183.664, 134.484, 143.471, 174.431,
112.766, 84.021, 109.633, 102.055, 122.228, 119.169, 126.669,
92.72, 84.557, 109.622, 115.52, 98.305, 100.016, 86.705, 88.524,
93.91, 121.433, 115.186, 138.775, 112.171, 139.945, 111.459,
137.648, 148.56, 151.7, 147.475, 130.412, 150.611, 144.699, 124.879,
127.666, 133.582, 128.419, 113.841, 143.732, 129.874, 147.084,
125.908, 98.857, 128.482, 135.695, 98.767, 94.26, 96.024, 68.207,
96.417, 122.438, 122.296, 105.178, 113.808, 123.345, 120.631,
77.151, 102.319, 118.283, 111.146, 103.658, 117.19, 119.658,
131.902, 141.754, 136.67, 130.594, 123.112, 99.02, 128.873, 143.095,
92.819, 113.151, 127.487, 113.512, 121.085, 147.4, 142.526, 151.355,
134.403, 146.5, 138.858, 155.043, 132.473, 126.667, 68.433, 70.066,
147.763, 146.615, 128.263, 130.767, 121.531, 125.728, 159.721,
132.185, 106.326, 162.808, 150.12, 133, 153.806, 138.598, 138.126,
120.59, 121.269, 139.493, 152.304, 71.971, 82.636, 98.034, 82.251,
102.697, 122.014, 97.708, 75.286, 52.676, 98.066, 94.866, 95.919,
82.12, 109.942, 91.606, 86.238, 125.225, 105.902, 119.013, 126.057,
124.857, 109.714, 120.282, 149.981, 81.801, 70.83, 142.661, 149.28,
139.454, 137.897, 119.04, 140.558, 148.685, 140.614, 164.547,
149.968, 136.695, 153.167, 171.521, 148.609, 151.662, 140.758,
139.857, 138.801, 116.912, 97.34, 61.571, 80.522, 88.731, 98.472,
74.622, 69.777, 82.164, 103.745, 99.347, 93.855, 102.203, 94.188,
98.527, 68.627, 63.579, 70.838, 87.632, 102.745, 92.405, 88.791,
70.331, 92.744, 106.656, 79.491, 61.176, 78.644, 98.818, 87.208,
98.686, 91.403, 75.044, 94.814, 87.394, 102.771, 90.769, 80.698,
58.295, 94.543, 81.545, 82.067, 95.034, 85.513, 89.924, 98.911,
68.598, 95.787, 71.672, 76.026, 79.773, 87.8, 71.2, 95.482, 87.57,
119.214, 77.196, 75.767, 62.02, 76.571, 89.089, 79.957, 75.821,
80.648, 85.476, 93.469, 78.106, 82.495, 83.729, 95.271, 85.641,
89.673, 86.904, 74.656, 105.274, 91.341, 106.678, 118.634, 100.529,
62.436, 72.042, 110.141, 78.265, 66.938, 87.006, 73.267, 94.289,
87.381, 97.522, 83.391, 147.455, 76.407, 94.759, 112.042, 104.347,
122.056, 104.762, 129.169, 125.432, 120.088, 84.685, 94.495,
92.923, 128.421, 120.352, 118.516, 106.805, 92.767, 98.958, 109.758,
121.721, 103.106, 123.208, 134.923, 69.045, 78.149, 60.458, 161.341,
174.319, 140.344, 157.43, 145.615, 66.009, 105.366, 112.884,
81.873, 109.462, 124.463, 106.618, 92.798, 111.902, 109.031,
110.728, 122.747, 146.079, 95.329, 71.645, 71.396, 105.551, 125.577,
108.667, 96.525, 129.236, 112.384, 108.867, 124.959, 115.832,
84.398, 109.375, 86.628, 106.676, 118.657, 113.338, 120.794,
127.88, 133.464, 98.284, 114.703, 92.94, 102.952, 107.424, 99.102,
81.107, 110.479, 137.737, 163.38, 151.75, 152.721, 133.849, 139.288,
117.071, 150.302, 142.243, 131.826, 127.75, 114.162, 118.68,
118.971, 102.493, 130.689, 159.573, 169.638, 178.302, 166.951,
156.924, 101.371, 108.549, 91.515, 93.934, 110.864, 111.93, 131.61,
109.916, 105.618, 116.5, 101.277, 114.187, 119.904, 105.36, 127.161,
154.102, 60.025, 49.68, 136.403, 138.291, 61.87, 94.677, 95.404,
98.725, 98.675, 93.288, 88.75, 78.517, 67.692, 90.513, 97.99,
88.561, 90.403, 80.934, 81.885, 97.8, 86.376, 85.306, 75.233,
111.649, 118.692, 103.755, 91.964, 98.381, 117.338, 164.294,
86.323, 58.865, 66.819, 116.067, 121.83, 127.481, 134.677, 112.538,
96.477, 98.662, 96.006, 81.853, 97.816, 106.143, 89.558, 114.297,
139.307, 134.272, 130.72, 130.2, 88.085, 108.413, 142.852, 133.355,
121.06, 89.391, 95.952, 96.659, 133.213, 125, 100.683, 92.884,
106.593, 107.779, 99.766, 103.653, 62.968, 116.287, 126.256,
135.006, 128.476, 132.255, 124.1, 149.011, 127.481, 136.932,
144.322, 113.102, 129.422, 122.393, 115.367, 111.584, 144.991,
116.725, 147.935, 135.571, 137.036, 171.311, 129.237, 128.368,
144.16, 115.514, 123.665, 129.138, 145.752, 118.607, 129.668,
113.674, 117.143, 108.503, 96.714, 137.52, 107.203, 111.435,
90.057, 119.367, 110.799, 101.931, 113.069, 120.825, 119.478,
106.346, 118.9, 161.491, 102.136, 93.389, 102.111, 96.429, 120.19
), Min = c(25L, 85L, 88L, 103L, 99L, 77L, 70L, 70L, 68L, 95L,
75L, 109L, 77L, 117L, 69L, 87L, 65L, 47L, 47L, 72L, 112L, 95L,
117L, 77L, 85L, 68L, 94L, 83L, 130L, 58L, 83L, 49L, 92L, 53L,
57L, 72L, 72L, 49L, 83L, 86L, 102L, 93L, 112L, 76L, 69L, 89L,
77L, 69L, 128L, 131L, 117L, 65L, 67L, 72L, 86L, 67L, 78L, 64L,
73L, 78L, 82L, 56L, 77L, 79L, 71L, 81L, 57L, 92L, 71L, 87L, 70L,
73L, 72L, 58L, 71L, 57L, 68L, 90L, 72L, 79L, 77L, 64L, 96L, 90L,
100L, 101L, 88L, 77L, 70L, 85L, 106L, 72L, 63L, 66L, 76L, 72L,
71L, 57L, 67L, 46L, 56L, 78L, 82L, 80L, 87L, 111L, 100L, 107L,
54L, 84L, 51L, 62L, 74L, 85L, 88L, 68L, 50L, 80L, 58L, 66L, 74L,
84L, 83L, 105L, 80L, 86L, 62L, 57L, 68L, 89L, 56L, 78L, 90L,
85L, 103L, 116L, 80L, 85L, 85L, 94L, 84L, 88L, 78L, 102L, 85L,
64L, 58L, 90L, 100L, 112L, 126L, 127L, 134L, 83L, 120L, 117L,
131L, 119L, 80L, 78L, 109L, 84L, 73L, 116L, 116L, 122L, 130L,
149L, 110L, 136L, 130L, 126L, 104L, 134L, 151L, 128L, 95L, 114L,
84L, 108L, 92L, 90L, 90L, 107L, 98L, 124L, 84L, 88L, 103L, 89L,
87L, 87L, 90L, 74L, 85L, 85L, 99L, 109L, 99L, 107L, 95L, 102L,
108L, 98L, 83L, 61L, 110L, 98L, 79L, 93L, 94L, 62L, 111L, 96L,
126L, 119L, 154L, 123L, 123L, 122L, 129L, 107L, 113L, 138L, 76L,
84L, 90L, 80L, 93L, 93L, 90L, 109L, 55L, 105L, 94L, 99L, 95L,
107L, 103L, 107L, 107L, 75L, 99L, 95L, 113L, 112L, 130L, 122L,
135L, 65L, 79L, 104L, 87L, 94L, 71L, 85L, 113L, 106L, 103L, 80L,
85L, 97L, 58L, 76L, 98L, 50L, 65L, 72L, 81L, 88L, 106L, 107L,
99L, 85L, 77L, 46L, 60L, 61L, 80L, 59L, 78L, 83L, 96L, 100L,
109L, 119L, 85L, 77L, 131L, 77L, 67L, 65L, 50L, 72L, 74L, 56L,
45L, 62L, 64L, 65L, 39L, 39L, 38L, 53L, 50L, 57L, 43L, 56L, 66L,
62L, 64L, 91L, 90L, 73L, 93L, 82L, 89L, 81L, 121L, 104L, 69L,
107L, 118L, 111L, 120L, 65L, 78L, 87L, 77L, 96L, 98L, 108L, 64L,
69L, 75L, 107L, 98L, 42L, 132L, 75L, 62L, 62L, 101L, 110L, 106L,
76L, 96L, 97L, 92L, 94L, 123L, 105L, 122L, 62L, 87L, 87L, 82L,
94L, 101L, 90L, 97L, 68L, 44L, 56L, 82L, 74L, 86L, 66L, 105L,
87L, 67L, 59L, 70L, 58L, 54L, 77L, 104L, 98L, 85L, 65L, 96L,
89L, 87L, 95L, 101L, 123L, 117L, 136L, 106L, 128L, 90L, 117L,
104L, 91L, 132L, 132L, 140L, 100L, 108L, 129L, 61L, 64L, 67L,
80L, 91L, 80L, 75L, 63L, 61L, 85L, 67L, 67L, 73L, 69L, 59L, 70L,
105L, 88L, 114L, 72L, 112L, 79L, 104L, 129L, 112L, 120L, 95L,
119L, 122L, 92L, 104L, 113L, 103L, 82L, 106L, 98L, 125L, 83L,
63L, 100L, 107L, 83L, 63L, 73L, 53L, 73L, 98L, 91L, 84L, 88L,
81L, 86L, 54L, 80L, 84L, 82L, 53L, 81L, 68L, 85L, 88L, 84L, 87L,
80L, 80L, 92L, 99L, 58L, 80L, 89L, 88L, 89L, 94L, 100L, 113L,
110L, 103L, 113L, 122L, 114L, 95L, 59L, 56L, 114L, 117L, 110L,
112L, 92L, 103L, 131L, 100L, 85L, 118L, 116L, 109L, 129L, 102L,
121L, 98L, 92L, 108L, 132L, 50L, 48L, 64L, 52L, 58L, 86L, 71L,
49L, 42L, 67L, 80L, 68L, 55L, 69L, 70L, 62L, 96L, 81L, 75L, 79L,
86L, 77L, 77L, 90L, 59L, 47L, 90L, 116L, 102L, 97L, 101L, 112L,
114L, 131L, 132L, 115L, 99L, 102L, 136L, 114L, 126L, 106L, 108L,
93L, 88L, 72L, 46L, 66L, 56L, 75L, 54L, 49L, 63L, 73L, 77L, 79L,
84L, 74L, 68L, 51L, 51L, 52L, 57L, 88L, 71L, 61L, 55L, 75L, 75L,
57L, 47L, 59L, 74L, 70L, 68L, 69L, 52L, 69L, 65L, 77L, 52L, 65L,
37L, 66L, 60L, 57L, 79L, 66L, 62L, 72L, 42L, 66L, 44L, 52L, 63L,
72L, 44L, 78L, 72L, 91L, 59L, 59L, 53L, 51L, 58L, 59L, 59L, 59L,
70L, 64L, 54L, 71L, 58L, 71L, 67L, 76L, 54L, 53L, 81L, 61L, 90L,
85L, 63L, 40L, 50L, 78L, 48L, 43L, 51L, 50L, 67L, 68L, 57L, 57L,
57L, 50L, 71L, 81L, 82L, 88L, 81L, 96L, 100L, 78L, 57L, 71L,
72L, 104L, 89L, 88L, 52L, 59L, 76L, 86L, 111L, 78L, 102L, 105L,
51L, 59L, 53L, 125L, 140L, 106L, 129L, 116L, 40L, 54L, 73L, 52L,
82L, 84L, 75L, 73L, 95L, 89L, 100L, 104L, 117L, 79L, 48L, 43L,
89L, 78L, 69L, 62L, 108L, 83L, 85L, 97L, 88L, 59L, 88L, 66L,
88L, 97L, 95L, 103L, 110L, 101L, 85L, 94L, 73L, 71L, 79L, 76L,
52L, 88L, 90L, 101L, 117L, 122L, 117L, 104L, 89L, 108L, 94L,
102L, 113L, 78L, 88L, 94L, 85L, 105L, 136L, 131L, 143L, 131L,
127L, 52L, 76L, 58L, 68L, 88L, 79L, 89L, 82L, 76L, 99L, 58L,
89L, 89L, 68L, 84L, 95L, 45L, 43L, 107L, 122L, 40L, 75L, 74L,
73L, 82L, 69L, 67L, 65L, 51L, 75L, 73L, 73L, 76L, 56L, 68L, 81L,
65L, 70L, 55L, 84L, 90L, 89L, 65L, 76L, 82L, 96L, 58L, 38L, 47L,
94L, 100L, 106L, 114L, 87L, 70L, 70L, 83L, 61L, 84L, 89L, 72L,
87L, 111L, 113L, 98L, 102L, 67L, 93L, 128L, 102L, 89L, 57L, 75L,
67L, 89L, 93L, 77L, 59L, 91L, 89L, 76L, 70L, 50L, 85L, 100L,
102L, 100L, 95L, 99L, 114L, 114L, 116L, 109L, 95L, 105L, 104L,
100L, 91L, 116L, 92L, 114L, 114L, 114L, 134L, 100L, 106L, 112L,
87L, 99L, 104L, 112L, 97L, 105L, 85L, 92L, 85L, 75L, 98L, 59L,
80L, 66L, 83L, 79L, 80L, 86L, 97L, 91L, 75L, 95L, 109L, 72L,
71L, 78L, 79L, 105L), Max = c(255L, 124L, 117L, 140L, 123L, 124L,
167L, 157L, 149L, 152L, 145L, 137L, 129L, 180L, 157L, 117L, 129L,
110L, 248L, 157L, 162L, 161L, 173L, 158L, 129L, 140L, 157L, 144L,
189L, 122L, 133L, 98L, 178L, 159L, 131L, 127L, 140L, 110L, 139L,
159L, 174L, 153L, 148L, 110L, 114L, 141L, 157L, 142L, 162L, 187L,
179L, 122L, 133L, 161L, 160L, 136L, 133L, 114L, 120L, 137L, 126L,
142L, 114L, 128L, 116L, 137L, 123L, 147L, 150L, 131L, 142L, 126L,
144L, 103L, 125L, 185L, 173L, 133L, 157L, 152L, 141L, 178L, 153L,
130L, 142L, 154L, 146L, 143L, 154L, 118L, 202L, 131L, 131L, 125L,
134L, 127L, 115L, 119L, 120L, 193L, 203L, 209L, 173L, 250L, 184L,
183L, 204L, 174L, 217L, 180L, 187L, 149L, 144L, 216L, 192L, 161L,
132L, 229L, 152L, 163L, 125L, 155L, 127L, 153L, 129L, 152L, 172L,
223L, 163L, 166L, 202L, 148L, 212L, 162L, 175L, 197L, 124L, 156L,
148L, 126L, 230L, 146L, 192L, 167L, 152L, 129L, 163L, 189L, 148L,
194L, 201L, 195L, 195L, 152L, 188L, 186L, 242L, 162L, 224L, 186L,
255L, 195L, 161L, 227L, 210L, 210L, 198L, 214L, 248L, 180L, 238L,
245L, 200L, 205L, 252L, 179L, 139L, 189L, 197L, 177L, 252L, 202L,
150L, 163L, 201L, 204L, 151L, 133L, 133L, 154L, 125L, 178L, 129L,
124L, 152L, 117L, 144L, 166L, 149L, 154L, 173L, 152L, 201L, 161L,
134L, 235L, 175L, 138L, 183L, 152L, 141L, 111L, 172L, 171L, 190L,
173L, 182L, 202L, 159L, 199L, 234L, 169L, 166L, 218L, 154L, 146L,
142L, 153L, 180L, 156L, 137L, 149L, 108L, 217L, 159L, 171L, 169L,
181L, 186L, 154L, 193L, 222L, 209L, 144L, 198L, 185L, 226L, 243L,
197L, 138L, 189L, 153L, 255L, 162L, 221L, 170L, 184L, 178L, 180L,
197L, 185L, 194L, 182L, 151L, 197L, 158L, 115L, 143L, 167L, 176L,
164L, 193L, 196L, 198L, 141L, 117L, 140L, 124L, 138L, 144L, 217L,
225L, 159L, 153L, 200L, 241L, 166L, 136L, 254L, 186L, 148L, 190L,
173L, 145L, 183L, 155L, 119L, 112L, 81L, 86L, 59L, 68L, 50L,
80L, 74L, 95L, 71L, 67L, 108L, 126L, 130L, 141L, 145L, 123L,
177L, 168L, 195L, 193L, 204L, 179L, 209L, 190L, 169L, 201L, 171L,
143L, 130L, 133L, 142L, 139L, 210L, 161L, 118L, 104L, 137L, 134L,
253L, 185L, 165L, 161L, 180L, 212L, 194L, 186L, 156L, 122L, 126L,
218L, 204L, 255L, 204L, 169L, 207L, 161L, 157L, 143L, 170L, 196L,
154L, 140L, 174L, 158L, 192L, 138L, 142L, 210L, 171L, 133L, 166L,
148L, 158L, 127L, 196L, 160L, 178L, 140L, 153L, 186L, 122L, 150L,
188L, 242L, 252L, 156L, 183L, 190L, 222L, 194L, 248L, 183L, 237L,
193L, 255L, 171L, 234L, 205L, 255L, 192L, 196L, 245L, 217L, 131L,
157L, 192L, 181L, 201L, 228L, 146L, 155L, 217L, 217L, 156L, 169L,
151L, 138L, 155L, 158L, 174L, 199L, 193L, 185L, 181L, 195L, 179L,
218L, 208L, 177L, 240L, 210L, 210L, 167L, 171L, 192L, 196L, 205L,
203L, 183L, 191L, 224L, 177L, 209L, 128L, 195L, 130L, 87L, 142L,
175L, 202L, 144L, 221L, 243L, 190L, 144L, 134L, 167L, 173L, 254L,
189L, 225L, 232L, 245L, 234L, 209L, 187L, 139L, 214L, 237L, 162L,
163L, 218L, 171L, 184L, 241L, 220L, 242L, 175L, 231L, 190L, 194L,
169L, 172L, 93L, 135L, 225L, 203L, 167L, 169L, 167L, 163L, 219L,
184L, 183L, 242L, 193L, 160L, 201L, 245L, 157L, 179L, 186L, 203L,
193L, 135L, 178L, 181L, 142L, 255L, 168L, 137L, 128L, 94L, 143L,
117L, 184L, 138L, 175L, 150L, 128L, 186L, 177L, 226L, 229L, 206L,
171L, 225L, 240L, 157L, 130L, 224L, 203L, 209L, 240L, 152L, 247L,
205L, 161L, 235L, 188L, 183L, 218L, 249L, 206L, 185L, 235L, 204L,
227L, 203L, 200L, 90L, 115L, 174L, 159L, 159L, 123L, 141L, 154L,
137L, 129L, 135L, 122L, 207L, 121L, 112L, 152L, 159L, 135L, 134L,
181L, 117L, 149L, 166L, 172L, 87L, 111L, 128L, 137L, 152L, 117L,
125L, 145L, 145L, 152L, 190L, 106L, 97L, 154L, 150L, 123L, 133L,
121L, 178L, 156L, 127L, 159L, 125L, 112L, 118L, 129L, 146L, 121L,
109L, 168L, 108L, 110L, 82L, 147L, 158L, 111L, 111L, 124L, 124L,
155L, 154L, 113L, 143L, 153L, 124L, 115L, 135L, 124L, 134L, 139L,
141L, 169L, 193L, 115L, 127L, 167L, 173L, 134L, 176L, 136L, 141L,
145L, 193L, 140L, 255L, 141L, 132L, 155L, 150L, 195L, 145L, 175L,
174L, 244L, 156L, 136L, 140L, 179L, 193L, 176L, 255L, 171L, 141L,
160L, 142L, 154L, 166L, 174L, 110L, 123L, 78L, 223L, 233L, 223L,
216L, 189L, 148L, 198L, 185L, 148L, 186L, 174L, 205L, 137L, 141L,
186L, 129L, 156L, 186L, 133L, 137L, 146L, 167L, 231L, 197L, 191L,
162L, 184L, 143L, 190L, 153L, 161L, 158L, 134L, 148L, 151L, 145L,
166L, 170L, 164L, 123L, 154L, 133L, 157L, 138L, 159L, 172L, 166L,
236L, 255L, 193L, 215L, 180L, 191L, 165L, 209L, 241L, 188L, 151L,
167L, 174L, 162L, 116L, 185L, 213L, 228L, 250L, 236L, 184L, 222L,
164L, 177L, 127L, 190L, 209L, 255L, 163L, 173L, 151L, 221L, 167L,
190L, 190L, 207L, 214L, 114L, 74L, 199L, 185L, 162L, 125L, 135L,
161L, 132L, 122L, 140L, 123L, 125L, 133L, 127L, 116L, 119L, 164L,
119L, 123L, 123L, 110L, 119L, 188L, 173L, 132L, 136L, 142L, 202L,
250L, 133L, 117L, 97L, 146L, 159L, 172L, 184L, 153L, 134L, 255L,
127L, 130L, 134L, 133L, 143L, 189L, 171L, 181L, 184L, 183L, 132L,
147L, 163L, 199L, 188L, 164L, 130L, 155L, 192L, 182L, 131L, 168L,
133L, 146L, 147L, 192L, 97L, 159L, 160L, 189L, 148L, 167L, 140L,
204L, 144L, 150L, 194L, 142L, 171L, 148L, 151L, 167L, 207L, 176L,
203L, 167L, 193L, 254L, 181L, 188L, 213L, 178L, 194L, 198L, 173L,
145L, 162L, 151L, 153L, 179L, 140L, 220L, 176L, 230L, 124L, 211L,
189L, 136L, 166L, 182L, 165L, 151L, 176L, 223L, 150L, 154L, 129L,
145L, 164L)), .Names = c("Area", "Mean", "Min", "Max"), class = "data.frame", row.names = c(NA,
-866L))
I have toyed with a number of ideas to do this, but so far have only come up with some rather inelegant solutions. I'm sure I could make it work, but the code would neither be pretty nor efficient. Here's the problem:
I have a series of integer pairs that are presented as rows in a two-column data frame. The goal is three-fold:
You need to "eliminate" all the rows in this data frame. To "eliminate" a row, you must select either one of the units from that pair and send/save it to a vector of "selected" elements.
You must find the smallest possible combination of "selected elements" that will eliminate all the pairs in the data frame.
The code must be computationally efficient because it will be applied to rather large datasets.
For instance, one would choose items "1" and "2" from the following list of pairs:
1 3
1 4
2 5
3 2
The data below can be used as a working example.
Thanks!
Vincent
Update for some context:
Hi Cipi and SiggyF.
I understand your concerns about this being homework, so in case you read this again, here's some context that I hope may dispell your doubts.
I am working with time-series cross sectional data in which N is much larger than T. I would like to use panel-corrected standard errors like those proposed in Beck & Katz (1995). The packages "pcse" is mostly able to do this just fine. When you have an unbalanced panel, it essentially creates a "rectangular" dataset (every time units has the full amount of observations) by filling in missing values for the omitted observations in every panel. Then, pcse computes a matrix Sigma.hat which is essentially the weighted average of the outer product of the residuals within time periods (think of it as averaging over an N X N X T array to bring it down to a N X N Sigma.hat).
The problem is that if any two units have zero contemporaneous observation, then the corresponding cell in Sigma.hat will be NA, and pcse won't be able to use it to get the sandwich estimator of the variance covariance matrix. In my example, the data frame numbers correspond to the index of the missing values in Sigma.hat. I want to trim down Sigma.hat automatically, to get an estimate of the VCOV that uses the most information possible, hence my desire to keep as many of the numbers in the data frame.
This is probably very unclear to anyone who hasn't looked into pcse, but I hope you get the gist of it.
Sorry to have given an impression of impropriety, but I assure you, this is legit.
test<-structure(list(row = c(27L, 44L,
45L, 111L, 128L, 129L, 195L, 212L,
213L, 279L, 296L, 297L, 363L, 380L,
381L, 7L, 91L, 175L, 259L, 343L, 44L,
45L, 70L, 128L, 129L, 154L, 212L,
213L, 238L, 296L, 297L, 322L, 380L,
381L, 406L, 7L, 37L, 48L, 91L, 121L,
132L, 175L, 205L, 216L, 259L, 289L,
300L, 343L, 373L, 384L, 7L, 37L, 48L,
91L, 121L, 132L, 175L, 205L, 216L,
259L, 289L, 300L, 343L, 373L, 384L,
44L, 45L, 128L, 129L, 212L, 213L,
296L, 297L, 380L, 381L, 37L, 121L,
205L, 289L, 373L, 27L, 44L, 45L, 111L,
128L, 129L, 195L, 212L, 213L, 279L,
296L, 297L, 363L, 380L, 381L, 7L,
91L, 175L, 259L, 343L, 44L, 45L, 70L,
128L, 129L, 154L, 212L, 213L, 238L,
296L, 297L, 322L, 380L, 381L, 406L,
7L, 37L, 48L, 91L, 121L, 132L, 175L,
205L, 216L, 259L, 289L, 300L, 343L,
373L, 384L, 7L, 37L, 48L, 91L, 121L,
132L, 175L, 205L, 216L, 259L, 289L,
300L, 343L, 373L, 384L, 44L, 45L,
128L, 129L, 212L, 213L, 296L, 297L,
380L, 381L, 37L, 121L, 205L, 289L,
373L, 27L, 44L, 45L, 111L, 128L,
129L, 195L, 212L, 213L, 279L, 296L,
297L, 363L, 380L, 381L, 7L, 91L,
175L, 259L, 343L, 44L, 45L, 70L, 128L,
129L, 154L, 212L, 213L, 238L, 296L,
297L, 322L, 380L, 381L, 406L, 7L,
37L, 48L, 91L, 121L, 132L, 175L, 205L,
216L, 259L, 289L, 300L, 343L, 373L,
384L, 7L, 37L, 48L, 91L, 121L, 132L,
175L, 205L, 216L, 259L, 289L, 300L,
343L, 373L, 384L, 44L, 45L, 128L,
129L, 212L, 213L, 296L, 297L, 380L,
381L, 37L, 121L, 205L, 289L, 373L,
27L, 44L, 45L, 111L, 128L, 129L, 195L,
212L, 213L, 279L, 296L, 297L, 363L,
380L, 381L, 7L, 91L, 175L, 259L, 343L,
44L, 45L, 70L, 128L, 129L, 154L,
212L, 213L, 238L, 296L, 297L, 322L,
380L, 381L, 406L, 7L, 37L, 48L, 91L,
121L, 132L, 175L, 205L, 216L, 259L,
289L, 300L, 343L, 373L, 384L, 7L, 37L,
48L, 91L, 121L, 132L, 175L, 205L,
216L, 259L, 289L, 300L, 343L, 373L,
384L, 44L, 45L, 128L, 129L, 212L,
213L, 296L, 297L, 380L, 381L, 37L,
121L, 205L, 289L, 373L, 27L, 44L,
45L, 111L, 128L, 129L, 195L, 212L,
213L, 279L, 296L, 297L, 363L, 380L,
381L, 7L, 91L, 175L, 259L, 343L, 44L,
45L, 70L, 128L, 129L, 154L, 212L,
213L, 238L, 296L, 297L, 322L, 380L,
381L, 406L, 7L, 37L, 48L, 91L, 121L,
132L, 175L, 205L, 216L, 259L, 289L,
300L, 343L, 373L, 384L, 7L, 37L, 48L,
91L, 121L, 132L, 175L, 205L, 216L,
259L, 289L, 300L, 343L, 373L, 384L,
44L, 45L, 128L, 129L, 212L, 213L,
296L, 297L, 380L, 381L, 37L, 121L,
205L, 289L, 373L), col = c(7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 27L, 27L, 27L, 27L, 27L,
37L, 37L, 37L, 37L, 37L, 37L, 37L,
37L, 37L, 37L, 37L, 37L, 37L, 37L,
37L, 44L, 44L, 44L, 44L, 44L, 44L,
44L, 44L, 44L, 44L, 44L, 44L, 44L,
44L, 44L, 45L, 45L, 45L, 45L, 45L,
45L, 45L, 45L, 45L, 45L, 45L, 45L,
45L, 45L, 45L, 48L, 48L, 48L, 48L,
48L, 48L, 48L, 48L, 48L, 48L, 70L,
70L, 70L, 70L, 70L, 91L, 91L, 91L,
91L, 91L, 91L, 91L, 91L, 91L, 91L,
91L, 91L, 91L, 91L, 91L, 111L, 111L,
111L, 111L, 111L, 121L, 121L, 121L,
121L, 121L, 121L, 121L, 121L, 121L,
121L, 121L, 121L, 121L, 121L, 121L,
128L, 128L, 128L, 128L, 128L, 128L,
128L, 128L, 128L, 128L, 128L, 128L,
128L, 128L, 128L, 129L, 129L, 129L,
129L, 129L, 129L, 129L, 129L, 129L,
129L, 129L, 129L, 129L, 129L, 129L,
132L, 132L, 132L, 132L, 132L, 132L,
132L, 132L, 132L, 132L, 154L, 154L,
154L, 154L, 154L, 175L, 175L, 175L,
175L, 175L, 175L, 175L, 175L, 175L,
175L, 175L, 175L, 175L, 175L, 175L,
195L, 195L, 195L, 195L, 195L, 205L,
205L, 205L, 205L, 205L, 205L, 205L,
205L, 205L, 205L, 205L, 205L, 205L,
205L, 205L, 212L, 212L, 212L, 212L,
212L, 212L, 212L, 212L, 212L, 212L,
212L, 212L, 212L, 212L, 212L, 213L,
213L, 213L, 213L, 213L, 213L, 213L,
213L, 213L, 213L, 213L, 213L, 213L,
213L, 213L, 216L, 216L, 216L, 216L,
216L, 216L, 216L, 216L, 216L, 216L,
238L, 238L, 238L, 238L, 238L, 259L,
259L, 259L, 259L, 259L, 259L, 259L,
259L, 259L, 259L, 259L, 259L, 259L,
259L, 259L, 279L, 279L, 279L, 279L,
279L, 289L, 289L, 289L, 289L, 289L,
289L, 289L, 289L, 289L, 289L, 289L,
289L, 289L, 289L, 289L, 296L, 296L,
296L, 296L, 296L, 296L, 296L, 296L,
296L, 296L, 296L, 296L, 296L, 296L,
296L, 297L, 297L, 297L, 297L, 297L,
297L, 297L, 297L, 297L, 297L, 297L,
297L, 297L, 297L, 297L, 300L, 300L,
300L, 300L, 300L, 300L, 300L, 300L,
300L, 300L, 322L, 322L, 322L, 322L,
322L, 343L, 343L, 343L, 343L, 343L,
343L, 343L, 343L, 343L, 343L, 343L,
343L, 343L, 343L, 343L, 363L, 363L,
363L, 363L, 363L, 373L, 373L, 373L,
373L, 373L, 373L, 373L, 373L, 373L,
373L, 373L, 373L, 373L, 373L, 373L,
380L, 380L, 380L, 380L, 380L, 380L,
380L, 380L, 380L, 380L, 380L, 380L,
380L, 380L, 380L, 381L, 381L, 381L,
381L, 381L, 381L, 381L, 381L, 381L,
381L, 381L, 381L, 381L, 381L, 381L,
384L, 384L, 384L, 384L, 384L, 384L,
384L, 384L, 384L, 384L, 406L, 406L,
406L, 406L, 406L)), .Names = c("row",
"col" ), row.names = c(NA, -400L),
class = "data.frame")
Ok, if you consider your elements as vertices, and your pairs as edges of a graph, and your problem becomes a case of the well known (and NP complete) vertex cover problem. You can easily find an approximate solution, guaranteed to be within a factor of two of optimal by choosing an arbitrary edge, and selecting both vertices, removing all eliminated edges, lather, rinse, repeat. You can do incrementally better with more complicated approximation algorithms, but finding the optimal solution with a large graph is probably not feasible.
Here is a simple function to do this. (Note R is not my native language, so this is probably hideously non idomatic, any suggestions for improvement would be appreciated).
good <- function(dat, result = NULL) {
sampr <- dat[sample(1:(dim(dat)[1]),1),]
if (dim(dat)[1] == 0){
result
} else {
good(subset(dat, row != sampr$row & row != sampr$col & col != sampr$row &
col != sampr$col),result = c(result, sampr$row, sampr$col))
}
}
I'd run this a number of times and keep the best one. (It might also be useful to keep track of the size of the worst one, as it gives you a lower bound on the optimal size). It might be useful to postprocess the result to remove excess vertices.
Running 10000 iterations (and removing redundant vertices) gives the following 19 element solution to your sample problem.
7 37 45 48 91 121 128 132 175 205 212 216 259 279 289 300 343 373 384
We also know that the optimal solution must have at least 15 vertices.