问:
Why can my merge function for mergeSort not be found? (C++)
I wrote code in C++ in visual studios to try and implement mergesort. Whenever I try to compile it gives the same error, C3681 'merge' identifier not found, which I don't understand what exactly is not being identified. Please help!</p>
```<code>#include <iostream>
#include <limits.h>
using namespace std;
void mergeSort(int A[], int p, int r) {
    int q;
    if (p < r) {
        q = p + (r - 1) / 2;
        mergeSort(A, p, q);
        mergeSort(A, q + 1, r);
        merge(A, p, q, r);
    }
}
void merge(int array[], int p, int q, int r) {
    int a, b, c;
    int m = q - p + 1;
    int n = r - q;
    int* left_array = new int[m + 1];
    int* right_array = new int[n + 1];
    for (int i = 0; i < m; i++) {
        left_array[i] = array[p + 1];
    }
    for (int j = 0; j < n; j++) {
        right_array[j] = array[q + 1 + j];
    }
    left_array[m + 1] = INT_MAX;
    right_array[n + 1] = INT_MAX;
    a = 0;
    b = 0;
    c = 1;
    while (a < m && b < n) {
        if (left_array[a] <= right_array[b]) {
            array[c] = left_array[a];
            a++;
        }
        else {
            array[c] = right_array[b];
            b++;
        }
        c++;
    }
    while (a < m) {
        array[c] = left_array[a];
        a++;
        c++;
    }
    while (b < n) {
        array[c] = left_array[b];
        b++;
        c++;
    }
}
}
int main(int argc, char* argv[]) {
    int A[10] = { 9,8,7,6,5,4,3,2,1,0 };
    mergeSort(A, 0, 9);
}
</code>```

答:
Well, maybe this can help you.
Implicit function declarations in C
Just in my opinion, C++ is drived by C, so sometimes for compatibility reasons, some C syntax is retained.</p>

Body:
I wrote code in C++ in visual studios to try and implement mergesort. Whenever I try to compile it gives the same error, C3681 'merge' identifier not found, which I don't understand what exactly is not being identified. Please help!

#include <iostream>
#include <limits.h>
using namespace std;
void mergeSort(int A[], int p, int r) {
    int q;
    if (p < r) {
        q = p + (r - 1) / 2;
        mergeSort(A, p, q);
        mergeSort(A, q + 1, r);
        merge(A, p, q, r);
    }
}
void merge(int array[], int p, int q, int r) {
    int a, b, c;
    int m = q - p + 1;
    int n = r - q;
    int* left_array = new int[m + 1];
    int* right_array = new int[n + 1];
    for (int i = 0; i < m; i++) {
        left_array[i] = array[p + 1];
    }
    for (int j = 0; j < n; j++) {
        right_array[j] = array[q + 1 + j];
    }
    left_array[m + 1] = INT_MAX;
    right_array[n + 1] = INT_MAX;
    a = 0;
    b = 0;
    c = 1;
    while (a < m && b < n) {
        if (left_array[a] <= right_array[b]) {
            array[c] = left_array[a];
            a++;
        }
        else {
            array[c] = right_array[b];
            b++;
        }
        c++;
    }
    while (a < m) {
        array[c] = left_array[a];
        a++;
        c++;
    }
    while (b < n) {
        array[c] = left_array[b];
        b++;
        c++;
    }
}
}
int main(int argc, char* argv[]) {
    int A[10] = { 9,8,7,6,5,4,3,2,1,0 };
    mergeSort(A, 0, 9);
}


来源: stackexchange

问:
return a string based on a case when statement
So i have two tables

I was wondering if anyone could help. So in my main table I have strings that have different formats.

Mac address are getting populated as the meter but it they are still linked in another table.

What is the best way to clean this data in bigquery to pull back the desired results of just the meters inplace of the mac addresses?

I have tried this so far but I'm not getting any results back, and I'm still getting mac address back where the meter should be?
The thing with the left join table is im also trying to return the MAP ID so long as the meter and L_meter join together too.

```<code>SELECT DISTINCT
    COALESCE(table2.L_METER,METER) AS METER,
    MAP.map_id AS Map,

FROM `table1 ` AS A
LEFT JOIN `table2` AS MAP ON METER = L_METER
                            AND METER = MAP.mac_address
</code>```

Main Table

METER

G4F00113102000

904DC300000RE122

904DC3000001E131

G4F00191402000

G4F00610542000

Left join table

L_METER
mac_address
MAP

E6S15544342061
904DC3000001E131
SSL

G4F00111072000
904DC300000RE122
SMP

G4F00113102000
904DC3000001T133
SMP

G4F00191402000
904DC3000001Y144
SMP

G4F00610542000
904DC3000001U55
SMP

Desired Results

METER

G4F00113102000

G4F00111072000

E6S15544342061

G4F00191402000

G4F00610542000

答:
You can use COALOESCE() with left join. If table1.METER=table2.mac_address then L_METER will be selected otherwise L_METER will be NULL and METER will be selected.

Schema and insert statements:

```<code> create table table1 (METER varchar(20));
 insert into table1 values('G4F00113102000');
 insert into table1 values('904DC300000RE122');
 insert into table1 values('904DC3000001E131');
 insert into table1 values('G4F00191402000');
 insert into table1 values('G4F00610542000');

 create table table2(L_METER    varchar(20),mac_address varchar(20));
 insert into table2 values('E6S15544342061','904DC3000001E131');
 insert into table2 values('G4F00111072000','904DC300000RE122');
 insert into table2 values('G4F00113102000','904DC3000001T133');
 insert into table2 values('G4F00191402000','904DC3000001Y144');
 insert into table2 values('G4F00610542000','904DC3000001U55');
</code>```

Query:

```<code> select coalesce(table2.L_METER,METER) METER
 from table1 left join table2
 ON table1.METER=table2.mac_address
</code>```

Output:

METER

G4F00113102000

G4F00111072000

E6S15544342061

G4F00191402000

G4F00610542000

db<>fiddle here

ContentLicense: CC BY-SA 4.0

Body:
So i have two tables

I was wondering if anyone could help. So in my main table I have strings that have different formats.

Mac address are getting populated as the meter but it they are still linked in another table.

What is the best way to clean this data in bigquery to pull back the desired results of just the meters inplace of the mac addresses?

I have tried this so far but I'm not getting any results back, and I'm still getting mac address back where the meter should be?
The thing with the left join table is im also trying to return the MAP ID so long as the meter and L_meter join together too.

SELECT DISTINCT
    COALESCE(table2.L_METER,METER) AS METER,
    MAP.map_id AS Map,

FROM `table1 ` AS A
LEFT JOIN `table2` AS MAP ON METER = L_METER
                            AND METER = MAP.mac_address

Main Table

METER

G4F00113102000

904DC300000RE122

904DC3000001E131

G4F00191402000

G4F00610542000

Left join table

L_METER
mac_address
MAP

E6S15544342061
904DC3000001E131
SSL

G4F00111072000
904DC300000RE122
SMP

G4F00113102000
904DC3000001T133
SMP

G4F00191402000
904DC3000001Y144
SMP

G4F00610542000
904DC3000001U55
SMP

Desired Results

METER

G4F00113102000

G4F00111072000

E6S15544342061

G4F00191402000

G4F00610542000

Body:
You can use COALOESCE() with left join. If table1.METER=table2.mac_address then L_METER will be selected otherwise L_METER will be NULL and METER will be selected.

Schema and insert statements:

 create table table1 (METER varchar(20));
 insert into table1 values('G4F00113102000');
 insert into table1 values('904DC300000RE122');
 insert into table1 values('904DC3000001E131');
 insert into table1 values('G4F00191402000');
 insert into table1 values('G4F00610542000');

 create table table2(L_METER    varchar(20),mac_address varchar(20));
 insert into table2 values('E6S15544342061','904DC3000001E131');
 insert into table2 values('G4F00111072000','904DC300000RE122');
 insert into table2 values('G4F00113102000','904DC3000001T133');
 insert into table2 values('G4F00191402000','904DC3000001Y144');
 insert into table2 values('G4F00610542000','904DC3000001U55');

Query:

 select coalesce(table2.L_METER,METER) METER
 from table1 left join table2
 ON table1.METER=table2.mac_address

Output:

METER

G4F00113102000

G4F00111072000

E6S15544342061

G4F00191402000

G4F00610542000

db<>fiddle here


问:
gradlew assembleRelease throwing compileSdkVersion is not specified error
I'm using gradle to build a react native app. I recently updated my Android SDK and now the following error is being thrown:

```<code>* What went wrong:
A problem occurred configuring project ':react-native-navigation'.
> compileSdkVersion is not specified.
</code>```

This is my top level gradle.build:

```<code>buildscript {
ext {
    buildToolsVersion = "29.0.2"
    minSdkVersion = 16
    compileSdkVersion = 29
    targetSdkVersion = 29
}
repositories {
    google()
    jcenter()
}
dependencies {
    classpath("com.android.tools.build:gradle:3.5.3")
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
</code>```

}

And this is my build script from inside the module:

```<code>android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.myapp"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
}
</code>```

Anyone have any idea how I might fix it?

答:
i solved the issue by adding ndk.dir in local.properties file.the local.properties file should look like this.

ndk.dir=/Users/[username]/Library/Android/sdk/ndk/your ndkversion ////23.1.7779620
sdk.dir=/Users/[username]/Library/Android/sdk

Body:
I'm using gradle to build a react native app. I recently updated my Android SDK and now the following error is being thrown:

* What went wrong:
A problem occurred configuring project ':react-native-navigation'.
> compileSdkVersion is not specified.

This is my top level gradle.build:

buildscript {
ext {
    buildToolsVersion = "29.0.2"
    minSdkVersion = 16
    compileSdkVersion = 29
    targetSdkVersion = 29
}
repositories {
    google()
    jcenter()
}
dependencies {
    classpath("com.android.tools.build:gradle:3.5.3")
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

And this is my build script from inside the module:

android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.myapp"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
}

Anyone have any idea how I might fix it?


问:
Overlapping Confidence Interval Alphas in ggplot2
I'm trying to visualize the confidence intervals for a set of Monte Carlo draws and am having some issues with my approach using alpha levels.

I'm running a loess regression for each draw and I wanted to try to visualize how the confidence intervals from each draw overlapped by displaying them on top of one another with reduced alphas to produce a gradient effect.

Essentially in the end produce the darkest areas would show where the confidence intervals overlapped the most.

As you can see in the example, the central portions are heavily obscured. While this pattern is to be expected, there isn't as much differentiation shown in the central portions as I need. I tried reducing the alpha level, but the result remained the same. <s> After some looking around I found that ggplot2 doesn't display alphas at levels lower than 0.1. </s>

Edit

As mentioned in the comment, the alpha can in fact be set below 0.1, and from my own quick testing it seems anything set at 0.005 is where it fails to display. Even though this is quite low, I would like to display the alpha at an even lower level or use an alternative approach if possible.

The included sample set is a little long, but in the initial 20 draw sample the problem wasn't as clear. This set shown here includes 50 draws, but the actual analysis consists of 1000 draws, so the effect is even more pronounced.

I'd like to know if there are any workaround to achieve an effect that is similar to what I'm looking for, or if there is another way to visualize this.

Sample plot image set at 0.1

Sample plot image set at 0.006

Sample code

```<code>ggplot(data = subset(play, !is.na(y)),
       aes(x = -x, y = y, group = RunID)) +
  geom_smooth(method = "loess", linetype = 0, alpha = 0.1) +
  scale_x_reverse() +
  theme_minimal()
</code>```

Reproducible sample

```dput(play)
structure(list(x = c(-4616, -4510, -4465, -4473, -4466, -4689,
-5301, -5214, -4880, -4869, -5122, -4771, -5045, -4535, -4670,
-4988, -4752, -4478, -4427, -4650, -5284, -4866, -4930, -4915,
-5136, -4599, -5246, -4806, -4554, -5046, -4429, -4419, -4494,
-4631, -4403, -5309, -5197, -4900, -4889, -5107, -5131, -4410,
-4635, -4558, -4912, -5010, -5330, -4484, -4669, -4665, -4541,
-4420, -5295, -4901, -4867, -4911, -5170, -4496, -5068, -4401,
-4680, -4810, -4528, -4980, -4487, -4626, -4649, -4456, -5296,
-5087, -4945, -4883, -5201, -5302, -4436, -4654, -4609, -5052,
-4909, -4485, -4531, -4423, -4609, -5280, -5091, -4901, -4862,
-5216, -4829, -4806, -4809, -4776, -4729, -5386, -4412, -4571,
-4595, -4410, -4475, -5302, -5010, -4891, -4867, -5217, -4870,
-4417, -4838, -4582, -4696, -5035, -5346, -4488, -4589, -4430,
-5275, -5150, -4878, -4929, -5118, -5284, -4968, -4737, -4877,
-5159, -4963, -4469, -4624, -4473, -4431, -5282, -5268, -4924,
-4928, -5228, -4891, -4923, -4643, -4550, -4848, -4878, -4451,
-4547, -4470, -4466, -4446, -5304, -5085, -4885, -4868, -5104,
-4742, -4703, -4586, -4930, -4747, -5226, -4550, -4448, -5290,
-4892, -4936, -4929, -5138, -5143, -4520, -4490, -4910, -4914,
-4505, -4574, -4540, -4476, -4500, -4645, -4462, -5306, -4924,
-4898, -4888, -5217, -5283, -4462, -4719, -4881, -4740, -4497,
-5234, -5111, -4461, -4413, -4480, -4566, -4552, -4424, -5303,
-4964, -4878, -4881, -5160, -4449, -4566, -4702, -4737, -4463,
-5070, -4422, -4457, -4452, -4681, -4578, -5271, -4873, -4887,
-4889, -5185, -4985, -4514, -4924, -4573, -4540, -5168, -4475,
-4594, -4662, -5299, -4990, -4869, -4923, -4435, -5170, -4488,
-4623, -4596, -4532, -4651, -4435, -4414, -4550, -4702, -4405,
-5283, -5267, -4927, -4915, -5193, -5177, -4959, -4647, -4569,
-4722, -5316, -4424, -4486, -4402, -4672, -4494, -5291, -5134,
-4883, -4950, -5125, -4814, -4405, -4674, -4729, -4668, -5244,
-5348, -4405, -4507, -4612, -4632, -4460, -5299, -4995, -4861,
-4944, -5171, -5220, -4906, -4875, -4766, -4709, -5213, -5085,
-4455, -4402, -4715, -4729, -4435, -4415, -5271, -5266, -4915,
-4919, -5148, -5324, -4706, -4824, -4847, -4786, -4425, -4447,
-4644, -4549, -4632, -5281, -5012, -4923, -4947, -5140, -5202,
-5188, -4747, -4642, -4633, -4689, -4433, -4474, -4616, -4462,
-4468, -5297, -5293, -4941, -4920, -5125, -4406, -5352, -4844,
-4590, -4423, -4456, -4436, -4675, -4507, -5297, -4867, -4900,
-4902, -4436, -5141, -4603, -4849, -4932, -4669, -4493, -4544,
-4434, -4490, -4409, -4590, -4418, -4698, -4471, -5288, -5309,
-4935, -4912, -5172, -4973, -4806, -4540, -4616, -4847, -5223,
-4449, -4481, -4541, -4617, -5301, -5177, -4938, -4893, -5179,
-5124, -4668, -4635, -4432, -4739, -4945, -4901, -4432, -4475,
-4661, -4503, -4442, -5309, -5271, -4941, -4925, -5204, -5242,
-5086, -4828, -4543, -5020, -5359, -4404, -4475, -4659, -4689,
-5276, -5241, -4944, -4862, -5119, -5286, -4403, -4517, -4610,
-4869, -4717, -5017, -4479, -4438, -4450, -4730, -4607, -4467,
-4453, -5307, -5157, -4884, -4861, -5213, -4444, -4675, -4886,
-4473, -4786, -5311, -4724, -4411, -4655, -4418, -4440, -5282,
-4875, -4909, -4872, -5193, -5242, -4909, -4565, -4615, -4881,
-5114, -4419, -4663, -4471, -5300, -5097, -4880, -4879, -5100,
-4610, -4428, -4618, -4922, -4778, -4907, -4403, -4605, -4585,
-4431, -5275, -5032, -4875, -4933, -5125, -5264, -4596, -4768,
-4630, -4550, -4444, -4415, -4495, -4685, -4433, -4481, -4423,
-5274, -5199, -4869, -4861, -5166, -5225, -5068, -4468, -4743,
-4586, -4936, -5319, -4873, -4422, -4471, -4705, -4589, -4428,
-5307, -4898, -4897, -4891, -5121, -4837, -4501, -4786, -4946,
-5253, -5061, -4421, -4717, -4528, -4448, -5291, -5062, -4897,
-4914, -5181, -5399, -4453, -5250, -4838, -4629, -4716, -4551,
-4689, -4425, -4467, -4592, -4401, -4427, -5270, -4984, -4867,
-4879, -5222, -4467, -4922, -4480, -4723, -4621, -4827, -4525,
-4538, -4586, -4426, -4463, -5285, -5096, -4895, -4890, -5200,
-4844, -4432, -4752, -4726, -5195, -5108, -4410, -4454, -4596,
-4475, -5279, -5014, -4939, -4942, -5210, -5357, -4795, -4580,
-4792, -4535, -4756, -5312, -4437, -4451, -4709, -4547, -4463,
-5286, -5217, -4877, -4905, -5185, -4984, -4532, -4809, -4492,
-4878, -4657, -4719, -4443, -4472, -4663, -4666, -4528, -5307,
-5115, -4940, -4932, -5148, -4837, -4479, -4901, -4538, -5017,
-4730, -4464, -4518, -4405, -4589, -5292, -5063, -4934, -4943,
-5168, -5219, -4509, -4774, -4460, -4809, -4843, -4740, -4426,
-4538, -4710, -4573, -4567, -4470, -4402, -5270, -5256, -4901,
-4916, -5196, -5326, -4855, -4726, -4558, -4458, -4448, -4539,
-4567, -4594, -4552, -5294, -4917, -4863, -4891, -5189, -4786,
-5329, -4669, -4680, -5302, -5285, -4459, -4472, -4673, -4720,
-5307, -4864, -4929, -4906, -5219, -5088, -5031, -4491, -4552,
-4560, -5187, -4497, -4649, -4466, -4715, -4444, -5270, -4999,
-4939, -4897, -5106, -4798, -4890, -4583, -4841, -4517, -4858,
-4484, -4432, -4714, -4447, -5300, -4876, -4932, -4949, -4428,
-5187, -4754, -5293, -4806, -4740, -4993, -4440, -4419, -4436,
-4682, -4648, -4609, -5290, -5128, -4862, -4861, -5105, -5181,
-4488, -4981, -4510, -4694, -5064, -4456, -4448, -4639, -4485,
-4537, -5299, -4975, -4943, -4865, -5190, -4628, -4921, -4552,
-4665, -4863, -4592, -4544, -4425, -4471, -4728, -4511, -5296,
-5284, -4928, -4863, -5172, -5069, -4970, -4803, -4722, -4852,
-4827, -5333, -4438, -4514, -4489, -4575, -4402, -4541, -5282,
-5031, -4908, -4928, -5161, -5370, -4453, -5381, -4694, -4578,
-4479, -4733, -4473, -4407, -4552, -4444, -4596, -4424, -5295,
-5114, -4933, -4915, -5156, -5385, -5106, -4713, -4692, -5305,
-5095, -4482, -4706, -4654, -4440, -5292, -5267, -4912, -4946,
-5114, -5295, -4542, -4543, -4745), y = c(0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.133333333333333,
0.126984126984127, 0.2, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.133333333333333, 0.2, 0.296296296296296,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.193548387096774, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.133333333333333,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.2, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.125,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296,
0.133333333333333, 0.160493827160494, 0.241803278688029, 0.2,
0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.133333333333333, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.2, 0.133333333333333, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.2, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.193548387096774, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.296296296296296,
0.125, 0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.133333333333333,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.130434782608696,
0.5, 0.191919191919192, 0.4, 0.2, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0.22884012539185,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.126984126984127, 0.2, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.133333333333333, 0.125, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.133333333333333,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.133333333333333,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.160493827160494, 0, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0.22884012539185, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.133333333333333, 0.126984126984127,
0.2, 0.296296296296296, 0.133333333333333, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.126984126984127, 0.2, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.296296296296296,
0.133333333333333, 0, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296,
0.125, 0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0, 0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.160493827160494, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.160493827160494, 0.125, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.2, 0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.126984126984127, 0.2, 0.296296296296296, 0.133333333333333,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.125, 0.241803278688029, 0.2,
0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.130434782608696, 0.5,
0.191919191919192, 0, 0.4, 0.126984126984127, 0.2, 0.133333333333333,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.2, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.133333333333333, 0.2, 0.296296296296296,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.133333333333333, 0.2, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.130434782608696,
0.5, 0.191919191919192, 0, 0.4, 0.126984126984127, 0.2, 0.296296296296296,
0.133333333333333, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.126984126984127,
0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.126984126984127, 0.2, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.133333333333333, 0.125, 0, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.133333333333333, 0.2, 0.296296296296296,
0.133333333333333, 0.160493827160494, 0.241803278688029, 0.2,
0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0.22884012539185, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.296296296296296,
0.133333333333333, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.193548387096774, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.126984126984127,
0.2, 0.296296296296296, 0.133333333333333, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5), RunID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 11L, 11L, 11L, 11L, 11L, 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, 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, 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, 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, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 21L, 21L, 21L, 21L, 21L, 21L,
21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 22L, 22L, 22L,
22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 23L,
23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L, 24L, 25L, 25L, 25L, 25L, 25L, 25L,
25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 26L, 26L, 26L,
26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L,
27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L,
27L, 27L, 27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 29L, 29L, 29L, 29L, 29L,
29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 30L, 30L, 30L, 30L,
30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 31L, 31L,
31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L,
31L, 31L, 31L, 31L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L,
32L, 32L, 32L, 32L, 32L, 32L, 32L, 33L, 33L, 33L, 33L, 33L, 33L,
33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 34L, 34L,
34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L,
34L, 34L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L,
35L, 35L, 35L, 35L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L,
36L, 36L, 36L, 36L, 36L, 36L, 36L, 37L, 37L, 37L, 37L, 37L, 37L,
37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 38L, 38L,
38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L,
38L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L,
39L, 39L, 39L, 39L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L,
40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 41L, 41L, 41L, 41L,
41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 42L, 42L,
42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L,
43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L,
43L, 43L, 43L, 44L, 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, 45L, 45L, 46L, 46L, 46L,
46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L,
47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L,
47L, 47L, 47L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L,
48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 49L, 49L, 49L, 49L, 49L,
49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 50L,
50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L,
50L)), groups = structure(list(.rows = structure(list(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, 50L, 51L,
    52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L,
    64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L,
    76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L,
    88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L,
    100L, 101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L,
    110L, 111L, 112L, 113L, 114L, 115L, 116L, 117L, 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, 149L,
    150L, 151L, 152L, 153L, 154L, 155L, 156L, 157L, 158L, 159L,
    160L, 161L, 162L, 163L, 164L, 165L, 166L, 167L, 168L, 169L,
    170L, 171L, 172L, 173L, 174L, 175L, 176L, 177L, 178L, 179L,
    180L, 181L, 182L, 183L, 184L, 185L, 186L, 187L, 188L, 189L,
    190L, 191L, 192L, 193L, 194L, 195L, 196L, 197L, 198L, 199L,
    200L, 201L, 202L, 203L, 204L, 205L, 206L, 207L, 208L, 209L,
    210L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L, 219L,
    220L, 221L, 222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L,
    230L, 231L, 232L, 233L, 234L, 235L, 236L, 237L, 238L, 239L,
    240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L, 248L, 249L,
    250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L, 258L, 259L,
    260L, 261L, 262L, 263L, 264L, 265L, 266L, 267L, 268L, 269L,
    270L, 271L, 272L, 273L, 274L, 275L, 276L, 277L, 278L, 279L,
    280L, 281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L,
    290L, 291L, 292L, 293L, 294L, 295L, 296L, 297L, 298L, 299L,
    300L, 301L, 302L, 303L, 304L, 305L, 306L, 307L, 308L, 309L,
    310L, 311L, 312L, 313L, 314L, 315L, 316L, 317L, 318L, 319L,
    320L, 321L, 322L, 323L, 324L, 325L, 326L, 327L, 328L, 329L,
    330L, 331L, 332L, 333L, 334L, 335L, 336L, 337L, 338L, 339L,
    340L, 341L, 342L, 343L, 344L, 345L, 346L, 347L, 348L, 349L,
    350L, 351L, 352L, 353L, 354L, 355L, 356L, 357L, 358L, 359L,
    360L, 361L, 362L, 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, 388L, 389L,
    390L, 391L, 392L, 393L, 394L, 395L, 396L, 397L, 398L, 399L,
    400L, 401L, 402L, 403L, 404L, 405L, 406L, 407L, 408L, 409L,
    410L, 411L, 412L, 413L, 414L, 415L, 416L, 417L, 418L, 419L,
    420L, 421L, 422L, 423L, 424L, 425L, 426L, 427L, 428L, 429L,
    430L, 431L, 432L, 433L, 434L, 435L, 436L, 437L, 438L, 439L,
    440L, 441L, 442L, 443L, 444L, 445L, 446L, 447L, 448L, 449L,
    450L, 451L, 452L, 453L, 454L, 455L, 456L, 457L, 458L, 459L,
    460L, 461L, 462L, 463L, 464L, 465L, 466L, 467L, 468L, 469L,
    470L, 471L, 472L, 473L, 474L, 475L, 476L, 477L, 478L, 479L,
    480L, 481L, 482L, 483L, 484L, 485L, 486L, 487L, 488L, 489L,
    490L, 491L, 492L, 493L, 494L, 495L, 496L, 497L, 498L, 499L,
    500L, 501L, 502L, 503L, 504L, 505L, 506L, 507L, 508L, 509L,
    510L, 511L, 512L, 513L, 514L, 515L, 516L, 517L, 518L, 519L,
    520L, 521L, 522L, 523L, 524L, 525L, 526L, 527L, 528L, 529L,
    530L, 531L, 532L, 533L, 534L, 535L, 536L, 537L, 538L, 539L,
    540L, 541L, 542L, 543L, 544L, 545L, 546L, 547L, 548L, 549L,
    550L, 551L, 552L, 553L, 554L, 555L, 556L, 557L, 558L, 559L,
    560L, 561L, 562L, 563L, 564L, 565L, 566L, 567L, 568L, 569L,
    570L, 571L, 572L, 573L, 574L, 575L, 576L, 577L, 578L, 579L,
    580L, 581L, 582L, 583L, 584L, 585L, 586L, 587L, 588L, 589L,
    590L, 591L, 592L, 593L, 594L, 595L, 596L, 597L, 598L, 599L,
    600L, 601L, 602L, 603L, 604L, 605L, 606L, 607L, 608L, 609L,
    610L, 611L, 612L, 613L, 614L, 615L, 616L, 617L, 618L, 619L,
    620L, 621L, 622L, 623L, 624L, 625L, 626L, 627L, 628L, 629L,
    630L, 631L, 632L, 633L, 634L, 635L, 636L, 637L, 638L, 639L,
    640L, 641L, 642L, 643L, 644L, 645L, 646L, 647L, 648L, 649L,
    650L, 651L, 652L, 653L, 654L, 655L, 656L, 657L, 658L, 659L,
    660L, 661L, 662L, 663L, 664L, 665L, 666L, 667L, 668L, 669L,
    670L, 671L, 672L, 673L, 674L, 675L, 676L, 677L, 678L, 679L,
    680L, 681L, 682L, 683L, 684L, 685L, 686L, 687L, 688L, 689L,
    690L, 691L, 692L, 693L, 694L, 695L, 696L, 697L, 698L, 699L,
    700L, 701L, 702L, 703L, 704L, 705L, 706L, 707L, 708L, 709L,
    710L, 711L, 712L, 713L, 714L, 715L, 716L, 717L, 718L, 719L,
    720L, 721L, 722L, 723L, 724L, 725L, 726L, 727L, 728L, 729L,
    730L, 731L, 732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L,
    740L, 741L, 742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L,
    750L, 751L, 752L, 753L, 754L, 755L, 756L, 757L, 758L, 759L,
    760L, 761L, 762L, 763L, 764L, 765L, 766L, 767L, 768L, 769L,
    770L, 771L, 772L, 773L, 774L, 775L, 776L, 777L, 778L, 779L,
    780L, 781L, 782L, 783L, 784L, 785L, 786L, 787L, 788L, 789L,
    790L, 791L, 792L, 793L, 794L, 795L, 796L, 797L, 798L, 799L,
    800L, 801L, 802L, 803L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -803L), class = c("tbl_df",
"tbl", "data.frame")), row.names = c(NA, -803L), class = c("rowwise_df",
"tbl_df", "tbl", "data.frame"))
```

答:
ggplot2 does recognise alpha values less than 0.1.

For example:

ggplot(data = subset(play, !is.na(y)), aes(x = -x, y = y, group = RunID)) +
    geom_smooth(method = "loess", linetype = 0, alpha = 0.01) +
    scale_x_reverse() +
    theme_minimal()
```

produces

Only when you use an alpha transparency scale through an aesthetic, values are mapped to alpha values in the interval [0.1, 1].

Body:
I'm trying to visualize the confidence intervals for a set of Monte Carlo draws and am having some issues with my approach using alpha levels.

I'm running a loess regression for each draw and I wanted to try to visualize how the confidence intervals from each draw overlapped by displaying them on top of one another with reduced alphas to produce a gradient effect.

Essentially in the end produce the darkest areas would show where the confidence intervals overlapped the most.

As you can see in the example, the central portions are heavily obscured. While this pattern is to be expected, there isn't as much differentiation shown in the central portions as I need. I tried reducing the alpha level, but the result remained the same. <s> After some looking around I found that ggplot2 doesn't display alphas at levels lower than 0.1. </s>

Edit

As mentioned in the comment, the alpha can in fact be set below 0.1, and from my own quick testing it seems anything set at 0.005 is where it fails to display. Even though this is quite low, I would like to display the alpha at an even lower level or use an alternative approach if possible.

The included sample set is a little long, but in the initial 20 draw sample the problem wasn't as clear. This set shown here includes 50 draws, but the actual analysis consists of 1000 draws, so the effect is even more pronounced.

I'd like to know if there are any workaround to achieve an effect that is similar to what I'm looking for, or if there is another way to visualize this.

Sample plot image set at 0.1

Sample plot image set at 0.006

Sample code

ggplot(data = subset(play, !is.na(y)),
       aes(x = -x, y = y, group = RunID)) +
  geom_smooth(method = "loess", linetype = 0, alpha = 0.1) +
  scale_x_reverse() +
  theme_minimal()

Reproducible sample

dput(play)
structure(list(x = c(-4616, -4510, -4465, -4473, -4466, -4689,
-5301, -5214, -4880, -4869, -5122, -4771, -5045, -4535, -4670,
-4988, -4752, -4478, -4427, -4650, -5284, -4866, -4930, -4915,
-5136, -4599, -5246, -4806, -4554, -5046, -4429, -4419, -4494,
-4631, -4403, -5309, -5197, -4900, -4889, -5107, -5131, -4410,
-4635, -4558, -4912, -5010, -5330, -4484, -4669, -4665, -4541,
-4420, -5295, -4901, -4867, -4911, -5170, -4496, -5068, -4401,
-4680, -4810, -4528, -4980, -4487, -4626, -4649, -4456, -5296,
-5087, -4945, -4883, -5201, -5302, -4436, -4654, -4609, -5052,
-4909, -4485, -4531, -4423, -4609, -5280, -5091, -4901, -4862,
-5216, -4829, -4806, -4809, -4776, -4729, -5386, -4412, -4571,
-4595, -4410, -4475, -5302, -5010, -4891, -4867, -5217, -4870,
-4417, -4838, -4582, -4696, -5035, -5346, -4488, -4589, -4430,
-5275, -5150, -4878, -4929, -5118, -5284, -4968, -4737, -4877,
-5159, -4963, -4469, -4624, -4473, -4431, -5282, -5268, -4924,
-4928, -5228, -4891, -4923, -4643, -4550, -4848, -4878, -4451,
-4547, -4470, -4466, -4446, -5304, -5085, -4885, -4868, -5104,
-4742, -4703, -4586, -4930, -4747, -5226, -4550, -4448, -5290,
-4892, -4936, -4929, -5138, -5143, -4520, -4490, -4910, -4914,
-4505, -4574, -4540, -4476, -4500, -4645, -4462, -5306, -4924,
-4898, -4888, -5217, -5283, -4462, -4719, -4881, -4740, -4497,
-5234, -5111, -4461, -4413, -4480, -4566, -4552, -4424, -5303,
-4964, -4878, -4881, -5160, -4449, -4566, -4702, -4737, -4463,
-5070, -4422, -4457, -4452, -4681, -4578, -5271, -4873, -4887,
-4889, -5185, -4985, -4514, -4924, -4573, -4540, -5168, -4475,
-4594, -4662, -5299, -4990, -4869, -4923, -4435, -5170, -4488,
-4623, -4596, -4532, -4651, -4435, -4414, -4550, -4702, -4405,
-5283, -5267, -4927, -4915, -5193, -5177, -4959, -4647, -4569,
-4722, -5316, -4424, -4486, -4402, -4672, -4494, -5291, -5134,
-4883, -4950, -5125, -4814, -4405, -4674, -4729, -4668, -5244,
-5348, -4405, -4507, -4612, -4632, -4460, -5299, -4995, -4861,
-4944, -5171, -5220, -4906, -4875, -4766, -4709, -5213, -5085,
-4455, -4402, -4715, -4729, -4435, -4415, -5271, -5266, -4915,
-4919, -5148, -5324, -4706, -4824, -4847, -4786, -4425, -4447,
-4644, -4549, -4632, -5281, -5012, -4923, -4947, -5140, -5202,
-5188, -4747, -4642, -4633, -4689, -4433, -4474, -4616, -4462,
-4468, -5297, -5293, -4941, -4920, -5125, -4406, -5352, -4844,
-4590, -4423, -4456, -4436, -4675, -4507, -5297, -4867, -4900,
-4902, -4436, -5141, -4603, -4849, -4932, -4669, -4493, -4544,
-4434, -4490, -4409, -4590, -4418, -4698, -4471, -5288, -5309,
-4935, -4912, -5172, -4973, -4806, -4540, -4616, -4847, -5223,
-4449, -4481, -4541, -4617, -5301, -5177, -4938, -4893, -5179,
-5124, -4668, -4635, -4432, -4739, -4945, -4901, -4432, -4475,
-4661, -4503, -4442, -5309, -5271, -4941, -4925, -5204, -5242,
-5086, -4828, -4543, -5020, -5359, -4404, -4475, -4659, -4689,
-5276, -5241, -4944, -4862, -5119, -5286, -4403, -4517, -4610,
-4869, -4717, -5017, -4479, -4438, -4450, -4730, -4607, -4467,
-4453, -5307, -5157, -4884, -4861, -5213, -4444, -4675, -4886,
-4473, -4786, -5311, -4724, -4411, -4655, -4418, -4440, -5282,
-4875, -4909, -4872, -5193, -5242, -4909, -4565, -4615, -4881,
-5114, -4419, -4663, -4471, -5300, -5097, -4880, -4879, -5100,
-4610, -4428, -4618, -4922, -4778, -4907, -4403, -4605, -4585,
-4431, -5275, -5032, -4875, -4933, -5125, -5264, -4596, -4768,
-4630, -4550, -4444, -4415, -4495, -4685, -4433, -4481, -4423,
-5274, -5199, -4869, -4861, -5166, -5225, -5068, -4468, -4743,
-4586, -4936, -5319, -4873, -4422, -4471, -4705, -4589, -4428,
-5307, -4898, -4897, -4891, -5121, -4837, -4501, -4786, -4946,
-5253, -5061, -4421, -4717, -4528, -4448, -5291, -5062, -4897,
-4914, -5181, -5399, -4453, -5250, -4838, -4629, -4716, -4551,
-4689, -4425, -4467, -4592, -4401, -4427, -5270, -4984, -4867,
-4879, -5222, -4467, -4922, -4480, -4723, -4621, -4827, -4525,
-4538, -4586, -4426, -4463, -5285, -5096, -4895, -4890, -5200,
-4844, -4432, -4752, -4726, -5195, -5108, -4410, -4454, -4596,
-4475, -5279, -5014, -4939, -4942, -5210, -5357, -4795, -4580,
-4792, -4535, -4756, -5312, -4437, -4451, -4709, -4547, -4463,
-5286, -5217, -4877, -4905, -5185, -4984, -4532, -4809, -4492,
-4878, -4657, -4719, -4443, -4472, -4663, -4666, -4528, -5307,
-5115, -4940, -4932, -5148, -4837, -4479, -4901, -4538, -5017,
-4730, -4464, -4518, -4405, -4589, -5292, -5063, -4934, -4943,
-5168, -5219, -4509, -4774, -4460, -4809, -4843, -4740, -4426,
-4538, -4710, -4573, -4567, -4470, -4402, -5270, -5256, -4901,
-4916, -5196, -5326, -4855, -4726, -4558, -4458, -4448, -4539,
-4567, -4594, -4552, -5294, -4917, -4863, -4891, -5189, -4786,
-5329, -4669, -4680, -5302, -5285, -4459, -4472, -4673, -4720,
-5307, -4864, -4929, -4906, -5219, -5088, -5031, -4491, -4552,
-4560, -5187, -4497, -4649, -4466, -4715, -4444, -5270, -4999,
-4939, -4897, -5106, -4798, -4890, -4583, -4841, -4517, -4858,
-4484, -4432, -4714, -4447, -5300, -4876, -4932, -4949, -4428,
-5187, -4754, -5293, -4806, -4740, -4993, -4440, -4419, -4436,
-4682, -4648, -4609, -5290, -5128, -4862, -4861, -5105, -5181,
-4488, -4981, -4510, -4694, -5064, -4456, -4448, -4639, -4485,
-4537, -5299, -4975, -4943, -4865, -5190, -4628, -4921, -4552,
-4665, -4863, -4592, -4544, -4425, -4471, -4728, -4511, -5296,
-5284, -4928, -4863, -5172, -5069, -4970, -4803, -4722, -4852,
-4827, -5333, -4438, -4514, -4489, -4575, -4402, -4541, -5282,
-5031, -4908, -4928, -5161, -5370, -4453, -5381, -4694, -4578,
-4479, -4733, -4473, -4407, -4552, -4444, -4596, -4424, -5295,
-5114, -4933, -4915, -5156, -5385, -5106, -4713, -4692, -5305,
-5095, -4482, -4706, -4654, -4440, -5292, -5267, -4912, -4946,
-5114, -5295, -4542, -4543, -4745), y = c(0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.133333333333333,
0.126984126984127, 0.2, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.133333333333333, 0.2, 0.296296296296296,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.193548387096774, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.133333333333333,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.2, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.125,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296,
0.133333333333333, 0.160493827160494, 0.241803278688029, 0.2,
0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.133333333333333, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.2, 0.133333333333333, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.2, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.193548387096774, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.296296296296296,
0.125, 0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.133333333333333,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.130434782608696,
0.5, 0.191919191919192, 0.4, 0.2, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0.22884012539185,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.126984126984127, 0.2, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.133333333333333, 0.125, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.133333333333333,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296, 0.133333333333333,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.160493827160494, 0, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0.22884012539185, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.133333333333333, 0.126984126984127,
0.2, 0.296296296296296, 0.133333333333333, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.126984126984127, 0.2, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.296296296296296,
0.133333333333333, 0, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.2, 0.296296296296296,
0.125, 0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0, 0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.160493827160494, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.160493827160494, 0.125, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.2, 0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.126984126984127, 0.2, 0.296296296296296, 0.133333333333333,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.125, 0.241803278688029, 0.2,
0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.130434782608696, 0.5,
0.191919191919192, 0, 0.4, 0.126984126984127, 0.2, 0.133333333333333,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.2, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.133333333333333, 0.2, 0.296296296296296,
0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.4, 0.133333333333333, 0.2, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.130434782608696,
0.5, 0.191919191919192, 0, 0.4, 0.126984126984127, 0.2, 0.296296296296296,
0.133333333333333, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.126984126984127,
0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.126984126984127, 0.2, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.130434782608696, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.133333333333333, 0.125, 0, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5, 0.191919191919192, 0, 0.133333333333333, 0.2, 0.296296296296296,
0.133333333333333, 0.160493827160494, 0.241803278688029, 0.2,
0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.160493827160494, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0.22884012539185, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.133333333333333,
0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.193548387096774,
0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0.133333333333333, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.2, 0.296296296296296, 0.241803278688029,
0.2, 0.0588235294117647, 0.244791666666667, 0, 0.2, 0.166666666666667,
0.184027777777778, 0.130434782608696, 0.5, 0.191919191919192,
0, 0.4, 0.133333333333333, 0.126984126984127, 0.2, 0.296296296296296,
0.133333333333333, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.193548387096774, 0.166666666666667,
0.184027777777778, 0.5, 0.191919191919192, 0, 0.4, 0.126984126984127,
0.2, 0.296296296296296, 0.133333333333333, 0.160493827160494,
0.241803278688029, 0.2, 0.0588235294117647, 0.244791666666667,
0, 0.2, 0.166666666666667, 0.184027777777778, 0.5, 0.191919191919192,
0, 0.4, 0.2, 0.296296296296296, 0, 0.241803278688029, 0.2, 0.0588235294117647,
0.244791666666667, 0, 0.2, 0.166666666666667, 0.184027777777778,
0.5), RunID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 11L, 11L, 11L, 11L, 11L, 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, 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, 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, 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, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 21L, 21L, 21L, 21L, 21L, 21L,
21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 22L, 22L, 22L,
22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 23L,
23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L, 24L, 25L, 25L, 25L, 25L, 25L, 25L,
25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 26L, 26L, 26L,
26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L,
27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L, 27L,
27L, 27L, 27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 28L, 28L, 28L, 29L, 29L, 29L, 29L, 29L,
29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 30L, 30L, 30L, 30L,
30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 30L, 31L, 31L,
31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L,
31L, 31L, 31L, 31L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L,
32L, 32L, 32L, 32L, 32L, 32L, 32L, 33L, 33L, 33L, 33L, 33L, 33L,
33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 33L, 34L, 34L,
34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L,
34L, 34L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L,
35L, 35L, 35L, 35L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L,
36L, 36L, 36L, 36L, 36L, 36L, 36L, 37L, 37L, 37L, 37L, 37L, 37L,
37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 38L, 38L,
38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L, 38L,
38L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L,
39L, 39L, 39L, 39L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L,
40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 41L, 41L, 41L, 41L,
41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 42L, 42L,
42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L,
43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L,
43L, 43L, 43L, 44L, 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, 45L, 45L, 46L, 46L, 46L,
46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L, 46L,
47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L,
47L, 47L, 47L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L,
48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 49L, 49L, 49L, 49L, 49L,
49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 50L,
50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L,
50L)), groups = structure(list(.rows = structure(list(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, 50L, 51L,
    52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L,
    64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L,
    76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L,
    88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L,
    100L, 101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L,
    110L, 111L, 112L, 113L, 114L, 115L, 116L, 117L, 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, 149L,
    150L, 151L, 152L, 153L, 154L, 155L, 156L, 157L, 158L, 159L,
    160L, 161L, 162L, 163L, 164L, 165L, 166L, 167L, 168L, 169L,
    170L, 171L, 172L, 173L, 174L, 175L, 176L, 177L, 178L, 179L,
    180L, 181L, 182L, 183L, 184L, 185L, 186L, 187L, 188L, 189L,
    190L, 191L, 192L, 193L, 194L, 195L, 196L, 197L, 198L, 199L,
    200L, 201L, 202L, 203L, 204L, 205L, 206L, 207L, 208L, 209L,
    210L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L, 219L,
    220L, 221L, 222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L,
    230L, 231L, 232L, 233L, 234L, 235L, 236L, 237L, 238L, 239L,
    240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L, 248L, 249L,
    250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L, 258L, 259L,
    260L, 261L, 262L, 263L, 264L, 265L, 266L, 267L, 268L, 269L,
    270L, 271L, 272L, 273L, 274L, 275L, 276L, 277L, 278L, 279L,
    280L, 281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L,
    290L, 291L, 292L, 293L, 294L, 295L, 296L, 297L, 298L, 299L,
    300L, 301L, 302L, 303L, 304L, 305L, 306L, 307L, 308L, 309L,
    310L, 311L, 312L, 313L, 314L, 315L, 316L, 317L, 318L, 319L,
    320L, 321L, 322L, 323L, 324L, 325L, 326L, 327L, 328L, 329L,
    330L, 331L, 332L, 333L, 334L, 335L, 336L, 337L, 338L, 339L,
    340L, 341L, 342L, 343L, 344L, 345L, 346L, 347L, 348L, 349L,
    350L, 351L, 352L, 353L, 354L, 355L, 356L, 357L, 358L, 359L,
    360L, 361L, 362L, 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, 388L, 389L,
    390L, 391L, 392L, 393L, 394L, 395L, 396L, 397L, 398L, 399L,
    400L, 401L, 402L, 403L, 404L, 405L, 406L, 407L, 408L, 409L,
    410L, 411L, 412L, 413L, 414L, 415L, 416L, 417L, 418L, 419L,
    420L, 421L, 422L, 423L, 424L, 425L, 426L, 427L, 428L, 429L,
    430L, 431L, 432L, 433L, 434L, 435L, 436L, 437L, 438L, 439L,
    440L, 441L, 442L, 443L, 444L, 445L, 446L, 447L, 448L, 449L,
    450L, 451L, 452L, 453L, 454L, 455L, 456L, 457L, 458L, 459L,
    460L, 461L, 462L, 463L, 464L, 465L, 466L, 467L, 468L, 469L,
    470L, 471L, 472L, 473L, 474L, 475L, 476L, 477L, 478L, 479L,
    480L, 481L, 482L, 483L, 484L, 485L, 486L, 487L, 488L, 489L,
    490L, 491L, 492L, 493L, 494L, 495L, 496L, 497L, 498L, 499L,
    500L, 501L, 502L, 503L, 504L, 505L, 506L, 507L, 508L, 509L,
    510L, 511L, 512L, 513L, 514L, 515L, 516L, 517L, 518L, 519L,
    520L, 521L, 522L, 523L, 524L, 525L, 526L, 527L, 528L, 529L,
    530L, 531L, 532L, 533L, 534L, 535L, 536L, 537L, 538L, 539L,
    540L, 541L, 542L, 543L, 544L, 545L, 546L, 547L, 548L, 549L,
    550L, 551L, 552L, 553L, 554L, 555L, 556L, 557L, 558L, 559L,
    560L, 561L, 562L, 563L, 564L, 565L, 566L, 567L, 568L, 569L,
    570L, 571L, 572L, 573L, 574L, 575L, 576L, 577L, 578L, 579L,
    580L, 581L, 582L, 583L, 584L, 585L, 586L, 587L, 588L, 589L,
    590L, 591L, 592L, 593L, 594L, 595L, 596L, 597L, 598L, 599L,
    600L, 601L, 602L, 603L, 604L, 605L, 606L, 607L, 608L, 609L,
    610L, 611L, 612L, 613L, 614L, 615L, 616L, 617L, 618L, 619L,
    620L, 621L, 622L, 623L, 624L, 625L, 626L, 627L, 628L, 629L,
    630L, 631L, 632L, 633L, 634L, 635L, 636L, 637L, 638L, 639L,
    640L, 641L, 642L, 643L, 644L, 645L, 646L, 647L, 648L, 649L,
    650L, 651L, 652L, 653L, 654L, 655L, 656L, 657L, 658L, 659L,
    660L, 661L, 662L, 663L, 664L, 665L, 666L, 667L, 668L, 669L,
    670L, 671L, 672L, 673L, 674L, 675L, 676L, 677L, 678L, 679L,
    680L, 681L, 682L, 683L, 684L, 685L, 686L, 687L, 688L, 689L,
    690L, 691L, 692L, 693L, 694L, 695L, 696L, 697L, 698L, 699L,
    700L, 701L, 702L, 703L, 704L, 705L, 706L, 707L, 708L, 709L,
    710L, 711L, 712L, 713L, 714L, 715L, 716L, 717L, 718L, 719L,
    720L, 721L, 722L, 723L, 724L, 725L, 726L, 727L, 728L, 729L,
    730L, 731L, 732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L,
    740L, 741L, 742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L,
    750L, 751L, 752L, 753L, 754L, 755L, 756L, 757L, 758L, 759L,
    760L, 761L, 762L, 763L, 764L, 765L, 766L, 767L, 768L, 769L,
    770L, 771L, 772L, 773L, 774L, 775L, 776L, 777L, 778L, 779L,
    780L, 781L, 782L, 783L, 784L, 785L, 786L, 787L, 788L, 789L,
    790L, 791L, 792L, 793L, 794L, 795L, 796L, 797L, 798L, 799L,
    800L, 801L, 802L, 803L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -803L), class = c("tbl_df",
"tbl", "data.frame")), row.names = c(NA, -803L), class = c("rowwise_df",
"tbl_df", "tbl", "data.frame"))

Body:
ggplot2 does recognise alpha values less than 0.1.

For example:

ggplot(data = subset(play, !is.na(y)), aes(x = -x, y = y, group = RunID)) +
    geom_smooth(method = "loess", linetype = 0, alpha = 0.01) +
    scale_x_reverse() +
    theme_minimal()

produces

Only when you use an alpha transparency scale through an aesthetic, values are mapped to alpha values in the interval [0.1, 1].


问:
Subsetting dataframe in grouped data
I have a dataframe including a column of factors that I would like to subset to select every nth row, after grouping by factor level.  For example,

```<code>my_df <- data.frame(col1 = c(1:12), col2 = rep(c("A","B", "C"), 4))
my_df
  col1 col2
1     1    A
2     2    B
3     3    C
4     4    A
5     5    B
6     6    C
7     7    A
8     8    B
9     9    C
10   10    A
11   11    B
12   12    C
</code>```

Subsetting to select every 2nd row should yield my_new_df as,

```<code>  col1 col2
1    4    A
2   10    A
3    5    B
4   11    B
5    6    C
6   12    C
</code>```

I tried in dplyr:

```<code>my_df %>% group_by(col2) %>%
my_df[seq(2, nrow(my_df), 2), ] -> my_new_df
</code>```

I get an error:

```<code>Error: Can't subset columns that don't exist.
x Locations 4, 6, 8, 10, and 12 don't exist.
ℹ There are only 2 columns.
</code>```

To see if the nrow function was a problem, I tried using the number directly. So,

```<code>my_df %>% group_by(col2) %>%
   my_df[seq(2, 4, 2), ] -> my_new_df
</code>```

Also gave an error,

```<code>Error: Can't subset columns that don't exist.
x Location 4 doesn't exist.
ℹ There are only 2 columns.
Run `rlang::last_error()` to see where the error occurred.
</code>```

My expectation was that it would run the subsetting on each group of data and then combine them into 'my_new_df'.  My understanding of how group_by works is clearly wrong but I am stuck on how to move past this error.  Any help would much appreciated.

答:
Try:

```<code>my_df %>%
  group_by(col2)%>%
  slice(seq(from = 2, to = n(), by = 2))

# A tibble: 6 x 2
# Groups:   col2 [3]
   col1 col2
  <int> <chr>
1     4 A
2    10 A
3     5 B
4    11 B
5     6 C
6    12 C
</code>```

You might want to ungroup after slicing if you want to do other operations not based on col2.

Title: Subsetting dataframe in grouped data

Body:
I have a dataframe including a column of factors that I would like to subset to select every nth row, after grouping by factor level.  For example,

my_df <- data.frame(col1 = c(1:12), col2 = rep(c("A","B", "C"), 4))
my_df
  col1 col2
1     1    A
2     2    B
3     3    C
4     4    A
5     5    B
6     6    C
7     7    A
8     8    B
9     9    C
10   10    A
11   11    B
12   12    C

Subsetting to select every 2nd row should yield my_new_df as,

  col1 col2
1    4    A
2   10    A
3    5    B
4   11    B
5    6    C
6   12    C

I tried in dplyr:

my_df %>% group_by(col2) %>%
my_df[seq(2, nrow(my_df), 2), ] -> my_new_df

I get an error:

Error: Can't subset columns that don't exist.
x Locations 4, 6, 8, 10, and 12 don't exist.
ℹ There are only 2 columns.

To see if the nrow function was a problem, I tried using the number directly. So,

my_df %>% group_by(col2) %>%
   my_df[seq(2, 4, 2), ] -> my_new_df

Also gave an error,

Error: Can't subset columns that don't exist.
x Location 4 doesn't exist.
ℹ There are only 2 columns.
Run `rlang::last_error()` to see where the error occurred.

My expectation was that it would run the subsetting on each group of data and then combine them into 'my_new_df'.  My understanding of how group_by works is clearly wrong but I am stuck on how to move past this error.  Any help would much appreciated.

Body:
Try:

my_df %>%
  group_by(col2)%>%
  slice(seq(from = 2, to = n(), by = 2))

# A tibble: 6 x 2
# Groups:   col2 [3]
   col1 col2
  <int> <chr>
1     4 A
2    10 A
3     5 B
4    11 B
5     6 C
6    12 C

You might want to ungroup after slicing if you want to do other operations not based on col2.


问:
Better way to use JdbcTemplate with Lambda RowMapper
Often in time I use jdbcTemplate.query not to return a resultset but to access the DB and do some computations on each record selected.
For example the code below works

```<code>    Map<String, Double> mAcc = new HashMap<>();
    sql = "select ar.id_codice_art, sum(ar.quantita) quantita\n" +
            "from accettazione a \n" +
            "inner join accettazione_riga ar on a.id_accettazione = ar.id_accettazione\n" +
            "where a.id_ordine = ? \n" +
            "group by ar.id_codice_art";
    jdbcTemplate.query(sql, (rs, i)->{
        mAcc.put(rs.getString("id_codice_art"), rs.getDouble("quantita"));
        return "";
    }, idOrdine);
</code>```

but it's not clean especially when a return "" because it is required by RowMapper interface. At the same time I don't want to create a record or a class just to return a list and work on the list.

Is there a better way to do the same think using jdbcTemplate?

答:
I'm assuming that the idOrdine key is a Long.

```<code>Map<String, Double> mAcc = new HashMap<>();
PreparedStatementSetter pss = ps -> ps.setLong(1, idOrdine);
RowCallbackHandler rch = rs -> mAcc.put(rs.getString("id_codice_art"),
     rs.getDouble("quantita"));
jdbcTemplate.query(sql, pss, rch);
</code>```

Of course, you can in-line those lambdas to avoid importing those two classes.

I just learned that in researching your answer, and now I'm going to rewrite a chunk of code I just wrote for work to use that method too!

Body:
Often in time I use jdbcTemplate.query not to return a resultset but to access the DB and do some computations on each record selected.
For example the code below works

    Map<String, Double> mAcc = new HashMap<>();
    sql = "select ar.id_codice_art, sum(ar.quantita) quantita\n" +
            "from accettazione a \n" +
            "inner join accettazione_riga ar on a.id_accettazione = ar.id_accettazione\n" +
            "where a.id_ordine = ? \n" +
            "group by ar.id_codice_art";
    jdbcTemplate.query(sql, (rs, i)->{
        mAcc.put(rs.getString("id_codice_art"), rs.getDouble("quantita"));
        return "";
    }, idOrdine);

but it's not clean especially when a return "" because it is required by RowMapper interface. At the same time I don't want to create a record or a class just to return a list and work on the list.

Is there a better way to do the same think using jdbcTemplate?

Body:
I'm assuming that the idOrdine key is a Long.

Map<String, Double> mAcc = new HashMap<>();
PreparedStatementSetter pss = ps -> ps.setLong(1, idOrdine);
RowCallbackHandler rch = rs -> mAcc.put(rs.getString("id_codice_art"),
     rs.getDouble("quantita"));
jdbcTemplate.query(sql, pss, rch);

Of course, you can in-line those lambdas to avoid importing those two classes.

I just learned that in researching your answer, and now I'm going to rewrite a chunk of code I just wrote for work to use that method too!


问:
Using require('jquery') with jsdom?
I can use JSDOM's 'scripts' option to load jquery for scraping. However I was wondering if it was possible, and also better or worse, to use node's own require mechanism now npm includes jquery.

```<code>jsdom = require 'jsdom'

config =
  html: "<html><body></body></html>"
  scripts: ['http://code.jquery.com/jquery-1.5.min.js']

jsdom.env config, (err, window) ->
  $ = window.jQuery;
  $('body').append("<div class='testing'>Hello World</div>")
  console.log(window.document.innerHTML)
</code>```

All works fine and shows the updated document. But these days we can also run:

```<code>$ = require 'jquery'
$('body').append("<div class='testing'>Hello World</div>")
</code>```

Which I find neater - I'm just not quite sure of how to use jquery and jsdom in this newer manner. Specifically, where is the window object?

答:
If you really need to get at the window:

```<code>var jquery = require('jquery');
var ctx = jquery('<p>this is some markup</p>');
console.log(ctx[0].ownerDocument._parentWindow);
</code>```

Use with caution, ._ properties are seen as private

ContentLicense: CC BY-SA 3.0

Title: Using require('jquery') with jsdom?

Body:
I can use JSDOM's 'scripts' option to load jquery for scraping. However I was wondering if it was possible, and also better or worse, to use node's own require mechanism now npm includes jquery.

jsdom = require 'jsdom'

config =
  html: ""
  scripts: ['http://code.jquery.com/jquery-1.5.min.js']

jsdom.env config, (err, window) ->
  $ = window.jQuery;
  $('body').append("
Hello World
")
  console.log(window.document.innerHTML)

All works fine and shows the updated document. But these days we can also run:

$ = require 'jquery'
$('body').append("
Hello World
")

Which I find neater - I'm just not quite sure of how to use jquery and jsdom in this newer manner. Specifically, where is the window object?

Body:
If you really need to get at the window:

var jquery = require('jquery');
var ctx = jquery('<p>this is some markup</p>');
console.log(ctx[0].ownerDocument._parentWindow);

Use with caution, ._ properties are seen as private


问:
How do I take away health for every two seconds of rectangle collision?
I've been trying to create a simple game in which zombies (represented by purple circles) are attacking a treasure.

Here's my code:

```<code>import pygame
from sys import exit
from random import randint

pygame.init()

clock = pygame.time.Clock()

screen_width = 1000
screen_height = 660
screen = pygame.display.set_mode((screen_width, screen_height))

# Treasure
treasure_health = 15
treasure_health_text = pygame.font.SysFont('comicsans', 30)
treasure = pygame.image.load(r"filename")
treasure_surf = pygame.transform.scale(treasure, (60, 60))
treasure_rect = treasure_surf.get_rect(center = (500, 330))

# Zombie
zombie_vel = 1
zombie = pygame.image.load(r"filename")
zombie_surf = pygame.transform.scale(zombie, (30, 25))
zombie_rect = zombie_surf.get_rect(center = (randint(0, 1000), randint(0, 600)))

while True:

    screen.fill('DarkGreen')
    screen.blit(treasure_surf, treasure_rect)
    screen.blit(zombie_surf, zombie_rect)

    for event in pygame.event.get():

        if event.type == pygame.QUIT:
            pygame.quit()
            exit()

    if zombie_rect.centerx < 500:
        zombie_rect.centerx += zombie_vel

    if zombie_rect.centerx > 500:
        zombie_rect.centerx -= zombie_vel

    if zombie_rect.centery < 330:
        zombie_rect.centery += zombie_vel

    if zombie_rect.centery > 330:
        zombie_rect.centery -= zombie_vel

    if zombie_rect.colliderect(treasure_rect):
        zombie_vel = 0
        # print(treasure_health)

    # Health
    treasure_health_surf = treasure_health_text.render(
        'Treasure Health: ' + str(treasure_health), False, ('Black'))
    treasure_health_rect = treasure_health_surf.get_rect(midleft = (0, 600))
    screen.blit(treasure_health_surf, treasure_health_rect)

    pygame.display.update()
    clock.tick(60)
</code>```

However, I want to make it so that every two seconds that a zombie has collided with the treasure, it takes one away from treasure_health, is there any way I can achieve this?

Thanks in advance.

答:
Use pygame.time.get_ticks() to measure time. This function measures the time since the game started in milliseconds. Once a collision is detected, calculate the time the zombie will take the next treasure:

zombie_time = 0
while True:
    current_time = pygame.time.get_ticks()

    # [...]

    if zombie_rect.colliderect(treasure_rect):
        zombie_vel = 0

        if zombie_time < current_time:
            zombie_time = current_time + 2000 # 2 seconds from now on
            if treasure_health > 0:
                treasure_health -= 1

    # [...]
```

Body:
I've been trying to create a simple game in which zombies (represented by purple circles) are attacking a treasure.

Here's my code:

import pygame
from sys import exit
from random import randint

pygame.init()

clock = pygame.time.Clock()

screen_width = 1000
screen_height = 660
screen = pygame.display.set_mode((screen_width, screen_height))

# Treasure
treasure_health = 15
treasure_health_text = pygame.font.SysFont('comicsans', 30)
treasure = pygame.image.load(r"filename")
treasure_surf = pygame.transform.scale(treasure, (60, 60))
treasure_rect = treasure_surf.get_rect(center = (500, 330))

# Zombie
zombie_vel = 1
zombie = pygame.image.load(r"filename")
zombie_surf = pygame.transform.scale(zombie, (30, 25))
zombie_rect = zombie_surf.get_rect(center = (randint(0, 1000), randint(0, 600)))

while True:

    screen.fill('DarkGreen')
    screen.blit(treasure_surf, treasure_rect)
    screen.blit(zombie_surf, zombie_rect)

    for event in pygame.event.get():

        if event.type == pygame.QUIT:
            pygame.quit()
            exit()

    if zombie_rect.centerx < 500:
        zombie_rect.centerx += zombie_vel

    if zombie_rect.centerx > 500:
        zombie_rect.centerx -= zombie_vel

    if zombie_rect.centery < 330:
        zombie_rect.centery += zombie_vel

    if zombie_rect.centery > 330:
        zombie_rect.centery -= zombie_vel

    if zombie_rect.colliderect(treasure_rect):
        zombie_vel = 0
        # print(treasure_health)

    # Health
    treasure_health_surf = treasure_health_text.render(
        'Treasure Health: ' + str(treasure_health), False, ('Black'))
    treasure_health_rect = treasure_health_surf.get_rect(midleft = (0, 600))
    screen.blit(treasure_health_surf, treasure_health_rect)

    pygame.display.update()
    clock.tick(60)

However, I want to make it so that every two seconds that a zombie has collided with the treasure, it takes one away from treasure_health, is there any way I can achieve this?

Thanks in advance.


问:
How to create a completely (uniformly) random dataset on PyTorch
I need to run some experiments on custom datasets using pytorch. The question is, how can I create a dataset using torch.Dataloader?

I have two lists, one is called Values and has a datapoint tensor at every entry, and the other one is called Labels, that has the corresponding label. What I did is the following:

```<code>for i in range(samples):
dataset[i] = [values[i],labels[I]]
</code>```

So I have a list with datapoint and respective label, and then tried the following:

```<code>dataset = torch.tensor(dataset).float()
dataset = torch.utils.data.TensorDataset(dataset)

data_loader = torch.utils.data.DataLoader(dataset=dataset, batch_size=100, shuffle=True, num_workers=4, pin_memory=True)
</code>```

But, first of all, I get the error "Not a sequence" in the torch.tensor command, and second, I'm not sure this is the right way of creating one. Any suggestion?

Thank you very much!

答:
Just to enrich the answer by @shai</p>
```<code>class MyDataset(Dataset):
    def __init__(self, values):
        super(MyDataset, self).__init__()
        self.values = values

    def __len__(self):
        return len(self.values)

    def __getitem__(self, index):
        return self.values[index]

values = np.random.rand(51000, 3)

dataset = MyDataset(values)
</code>```

Body:
I need to run some experiments on custom datasets using pytorch. The question is, how can I create a dataset using torch.Dataloader?

I have two lists, one is called Values and has a datapoint tensor at every entry, and the other one is called Labels, that has the corresponding label. What I did is the following:

for i in range(samples):
dataset[i] = [values[i],labels[I]]

So I have a list with datapoint and respective label, and then tried the following:

dataset = torch.tensor(dataset).float()
dataset = torch.utils.data.TensorDataset(dataset)

data_loader = torch.utils.data.DataLoader(dataset=dataset, batch_size=100, shuffle=True, num_workers=4, pin_memory=True)

But, first of all, I get the error "Not a sequence" in the torch.tensor command, and second, I'm not sure this is the right way of creating one. Any suggestion?

Thank you very much!

Body:
Just to enrich the answer by @shai

class MyDataset(Dataset):
    def __init__(self, values):
        super(MyDataset, self).__init__()
        self.values = values

    def __len__(self):
        return len(self.values)

    def __getitem__(self, index):
        return self.values[index]

values = np.random.rand(51000, 3)

dataset = MyDataset(values)


问:
How to display an empty item of recyclerview so that user can fill the data into it?
I am new to kotlin-android and I am developing a stock keeping unit, where in one fragment i need to load the data into recycler view using arraylist but also, i need one blank item, where user can enter his own data and once he fills that blank item, a new blank item should be created.

```<code>    class RecyclerViewAdapterU (val dataList:ArrayList<ModelClass>): RecyclerView.Adapter<RecyclerViewAdapterU.ViewHolder>() {
    var _binding: UploadItemViewBinding? = null
    val binding get() = _binding!!

        override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): RecyclerViewAdapterU.ViewHolder {

        val v =
            LayoutInflater.from(parent.context).inflate(R.layout.upload_item_view, parent, false)
        _binding = UploadItemViewBinding.bind(v)

        return ViewHolder(binding.root)
    }

    fun getUpdatedDetails(skucode:String,pos:Int){
       // val skuDetails:ArrayList<ModelClass>
        val call: Call<List<ModelClass>>? =
            ApiClient.instance?.myApi?.getfromsku(skucode)!!
        call!!.enqueue(object : Callback<List<ModelClass>?> {
            override fun onResponse(
                call: Call<List<ModelClass>?>,
                response: Response<List<ModelClass>?>
            ) {
                if (!response.body().isNullOrEmpty()) {
                    val skuDetails: ArrayList<ModelClass> = response.body() as ArrayList<ModelClass>
//
//                    if (!skuDetails.isNullOrEmpty()) {
                        val x = dataList[pos].sku_code
                        if (skuDetails[pos].sku_code != x) {
                            //for (i in skuDetails.indices){
                            println(skuDetails[pos].sku_code)
                            println(".........$pos")

                            dataList.removeAt(pos)
                            dataList.add(pos, skuDetails[0])
                            skuDetails.clear()
                            notifyItemChanged(pos)

                            //}
                        }
                    }

            }

            override fun onFailure(call: Call<List<ModelClass>?>, t: Throwable) {

            }
        })

    }

    override fun onBindViewHolder(holder: ViewHolder, @SuppressLint("RecyclerView") position: Int) {

        bindItems(dataList[position])
        holder.getStock()
      holder.updateStockDetail()

    }
    fun bindItems(data: ModelClass) {

        binding.apply {
            itemquant.text=data.item_quant
            uploadItemName.text = data.item_name
            uploadMfg.text = data.mfg
            skuStock.setText(data.item_stock.toString())
             skuCode.setText(data.sku_code)
        }

    }

    override fun getItemCount(): Int {
        return dataList.size
    }

    inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

        fun getStock() {

            binding.skuStock.addTextChangedListener(object : TextWatcher {
                override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
                override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
                override fun afterTextChanged(editable: Editable) {
                    if (binding.skuStock.isFocused){
                    for (i in 0 until RecyclerViewAdapter.ob.dataSelected.size){
                        if (editable.toString().trim()!=""){
                            var x= editable.toString().trim().toInt()

                            RecyclerViewAdapter.ob.dataSelected[adapterPosition].item_stock=x
                            //getting current itemstock before pushing update.
                            //assigning latest itemstock to the data for the update
                        }
                    }
                }}

            })
        }

        fun updateStockDetail(){
            binding.skuCode.addTextChangedListener(object : TextWatcher{
                override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
                override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {
                }
                override fun afterTextChanged(editable: Editable) {
                    //binding.skuCode.removeTextChangedListener(this)
                    var pos:Int=adapterPosition
                    var x= editable.toString().trim()

                    //RecyclerViewAdapter.ob.dataSelected[adapterPosition].sku_code=x
                    println("$x in textwatcher and $pos")

                    //getting edited text and calling the function to get updated details.

                    getUpdatedDetails(x,pos)
                  // binding.skuCode.addTextChangedListener(this)

                }
            })

        }

    }
}
</code>```

I have couple of bugs in the adapter too, for example, i cant change textwatcher more than once.
If somebody could help me with this, would be very glad.

ob.data.selected comes from another recyclerview adapter.

答:
One way you can do this is by using a different view type for the blank item that will always stay at the very top (or bottom if you prefer). Once the blank item is filled up then a new non-blank item with a different view type will be added to your list.

More info about view types here: Android and Kotlin: RecyclerView with multiple view types

Body:
I am new to kotlin-android and I am developing a stock keeping unit, where in one fragment i need to load the data into recycler view using arraylist but also, i need one blank item, where user can enter his own data and once he fills that blank item, a new blank item should be created.

    class RecyclerViewAdapterU (val dataList:ArrayList<ModelClass>): RecyclerView.Adapter<RecyclerViewAdapterU.ViewHolder>() {
    var _binding: UploadItemViewBinding? = null
    val binding get() = _binding!!

        override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): RecyclerViewAdapterU.ViewHolder {

        val v =
            LayoutInflater.from(parent.context).inflate(R.layout.upload_item_view, parent, false)
        _binding = UploadItemViewBinding.bind(v)

        return ViewHolder(binding.root)
    }

    fun getUpdatedDetails(skucode:String,pos:Int){
       // val skuDetails:ArrayList<ModelClass>
        val call: Call<List<ModelClass>>? =
            ApiClient.instance?.myApi?.getfromsku(skucode)!!
        call!!.enqueue(object : Callback<List<ModelClass>?> {
            override fun onResponse(
                call: Call<List<ModelClass>?>,
                response: Response<List<ModelClass>?>
            ) {
                if (!response.body().isNullOrEmpty()) {
                    val skuDetails: ArrayList<ModelClass> = response.body() as ArrayList<ModelClass>
//
//                    if (!skuDetails.isNullOrEmpty()) {
                        val x = dataList[pos].sku_code
                        if (skuDetails[pos].sku_code != x) {
                            //for (i in skuDetails.indices){
                            println(skuDetails[pos].sku_code)
                            println(".........$pos")

                            dataList.removeAt(pos)
                            dataList.add(pos, skuDetails[0])
                            skuDetails.clear()
                            notifyItemChanged(pos)

                            //}
                        }
                    }

            }

            override fun onFailure(call: Call<List<ModelClass>?>, t: Throwable) {

            }
        })

    }

    override fun onBindViewHolder(holder: ViewHolder, @SuppressLint("RecyclerView") position: Int) {

        bindItems(dataList[position])
        holder.getStock()
      holder.updateStockDetail()

    }
    fun bindItems(data: ModelClass) {

        binding.apply {
            itemquant.text=data.item_quant
            uploadItemName.text = data.item_name
            uploadMfg.text = data.mfg
            skuStock.setText(data.item_stock.toString())
             skuCode.setText(data.sku_code)
        }

    }

    override fun getItemCount(): Int {
        return dataList.size
    }

    inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

        fun getStock() {

            binding.skuStock.addTextChangedListener(object : TextWatcher {
                override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
                override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
                override fun afterTextChanged(editable: Editable) {
                    if (binding.skuStock.isFocused){
                    for (i in 0 until RecyclerViewAdapter.ob.dataSelected.size){
                        if (editable.toString().trim()!=""){
                            var x= editable.toString().trim().toInt()

                            RecyclerViewAdapter.ob.dataSelected[adapterPosition].item_stock=x
                            //getting current itemstock before pushing update.
                            //assigning latest itemstock to the data for the update
                        }
                    }
                }}

            })
        }

        fun updateStockDetail(){
            binding.skuCode.addTextChangedListener(object : TextWatcher{
                override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
                override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {
                }
                override fun afterTextChanged(editable: Editable) {
                    //binding.skuCode.removeTextChangedListener(this)
                    var pos:Int=adapterPosition
                    var x= editable.toString().trim()

                    //RecyclerViewAdapter.ob.dataSelected[adapterPosition].sku_code=x
                    println("$x in textwatcher and $pos")

                    //getting edited text and calling the function to get updated details.

                    getUpdatedDetails(x,pos)
                  // binding.skuCode.addTextChangedListener(this)

                }
            })

        }

    }
}

I have couple of bugs in the adapter too, for example, i cant change textwatcher more than once.
If somebody could help me with this, would be very glad.

ob.data.selected comes from another recyclerview adapter.