Questions tagged [pairwise]
273 questions
2
votes
1 answer
How to convert in a string a dataframe to fix an error to plot properly some graphs?
I'm trying plotting some graphs via the following loop:
library(ggstatsplot)
for (i in 5:ncol(df)) {
print(ggbetweenstats(df,
x = 'D', y = colnames(df[i]),
palette = 'npg',
…

12666727b9
- 1,133
- 1
- 8
- 22
2
votes
1 answer
R- Subset or print all possible column pairs from a 5x14 dataframe
I have an R dataframe with 14 columns and 5 rows (without headers and row names), and I would like to extract all of the possible column pairs, unique if possible.
For example, my input dataframe:
C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12…

Carlos
- 35
- 3
2
votes
3 answers
Return maximum of conditionally selected pairs from a vector in R
Reproducible example:
set.seed(1)
A <- round(runif(12, min = 1, max = 5))
> A
[1] 1 2 2 4 3 4 3 4 5 3 4 5
expectedResult <- c(max(A[1], A[4]), max(A[2], A[5]), max(A[3], A[6]), max(A[7], A[10]), max(A[8], A[11]), max(A[9], A[12]))
>…

Rel_Ai
- 581
- 2
- 11
2
votes
1 answer
Pairwise Cohen's Kappa of rows in DataFrame in Pandas (python)
I'd greatly appreciate some help on this. I'm using jupyter notebook.
I have a dataframe where I want calculate the interrater reliability. I want to compare them pairwise by the value of the ID column (all IDs have a frequency of 2, one for each…

Anna Louise Todsen
- 23
- 3
2
votes
1 answer
Find the N smallest values in a pair-wise comparison NxN numpy array?
I have a python NxN numpy pair-wise array (matrix) of double values. Each array element of e.g., (i,j), is a measurement between the i and j item. The diagonal, where i==j, is 1 as it's a pairwise measurement of itself. This also means that the 2D…

Anthony Nash
- 834
- 1
- 9
- 26
2
votes
1 answer
Efficient algorithm to check queue consistency by pairwise relationship
We have n items entering and leaving a queue, they could enter and leave at any time. The information we have is that for each pair (a, b), we know either
1) a leaves the queue before b enters or vice versa;
2) at some point, a and b are in the…

AT6996
- 39
- 4
2
votes
2 answers
Pytorch pairwise concatenation of tensors
I'd like to compute a pairwise concatenation over a specific dimension in a batched manner.
For instance,
x = torch.tensor([[[0],[1],[2]],[[3],[4],[5]]])
x.shape = torch.Size([2, 3, 1])
I would like to get y such that y is the concatenation of all…

astiegler
- 315
- 3
- 15
2
votes
3 answers
R: how to obtain unique pairwise combinations of 2 vectors
x = 1:3
y = 1:3
> expand.grid(x = 1:3, y = 1:3)
x y
1 1 1
2 2 1
3 3 1
4 1 2
5 2 2
6 3 2
7 1 3
8 2 3
9 3 3
Using expand.grid gives me all of the combinations. However, I want only pairwise comparisons, that is, I don't want a comparison of 1 vs 1,…

Adrian
- 9,229
- 24
- 74
- 132
2
votes
1 answer
Is there a way in R for doing a pairwise-weighted correlation matrix?
I have a survey with a lot of numeric variables (both continuous and dummy-binary) and more than 800 observations. Of course, there is missing data for most of the variables (at a different rate). I need to use a weighted correlation table because…

Alexander Abuabara
- 19
- 6
2
votes
2 answers
Matching values from two column pairs in different data frames in R
I have two data frames which are edge lists containing columns "source" and "target" as their first two columns and the second data frame includes a third column with edge attributes. The two data frames are not of the same length and I want (1) to…

JimmyDS
- 23
- 3
2
votes
2 answers
All pairwise multiplication of elements, excluding same element
I have a dictionary of numbers, and I would like to get a list of all pairwise multiplications, excluding multiplication with itself.
test_dict = {'id_1': 8, 'id_2': 9, 'id_3': 10}
test_keys = list(test_dict.keys())
list_of_multiples = []
for i in…

littlefield
- 55
- 5
2
votes
2 answers
make pairwise difference of array with python
I have an array with numbers like this, in this case 5 numbers:
a = array([2.88581812, 2.8930633 , 2.85603976, 2.86739916, 2.85736707])
I would like to create an array of 10 elements in which the pairwise difference of all the numbers of the array…

Fred
- 23
- 2
2
votes
2 answers
Pairwise row match of tables in Python
I am trying to do a pairwise comparison for 100+ tables to find the rows in common by "ID".
Is there a simple way to do such a pairwise comparison without going through a lot of loops?
The expected output is a matrix/heatmap showing the similarity…

Learner123
- 87
- 5
2
votes
2 answers
R - Why pairwise Fishers test produces different results to Fishers on each combination
I am trying to do Fisher's exact test for combinations of an n x 2 dataframe and from what I have read, pairwise fishers seems to be what I want to use (see here). However, in doing so it produced p-value results that didn't look right, so I decided…

arnold-c
- 337
- 2
- 13
2
votes
2 answers
How to check if pairs from df2 are in pairs of df1 (inclusive) in R?
I have a two dataframes, where I want to compare pairs of dataframe b, to the pairs of dataframe a, and see if the pairs from b fall within (inclusive) the pairs/range of those in a. For instance, see below:
df_1 <- data.frame(x= c(-82.38319,…

CaseebRamos
- 684
- 3
- 18