Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
2 answers
113 views

How to create a mask based on points coordinates?

Starting from this situation: I would like to create a boolean mask where all external points are considered as True while all internal point are False. Something like this : The objective would be ...
Certes's user avatar
  • 159
1 vote
3 answers
120 views

Can we retrieve entries from a tibble using index matrix?

I have a matrix where the row and column indices are stored that I want to retrieve from a dataset. With a data.frame this works fine: set.seed(1) df <- data.frame(a= letters[1:10], b= LETTERS[1:10]...
LulY's user avatar
  • 1,324
2 votes
1 answer
102 views

Minimum required number of rows in a boolean matrix, such that the resulting submatrix has at least one `1` in each column?

Background Let's say, in a boolean matrix m, we have 1s randomly distributed in each row, e.g., > set.seed(1) > (m <- matrix(+(runif(30) > 0.6), 6)) [,1] [,2] [,3] [,4] [,5] [1,] ...
ThomasIsCoding's user avatar
0 votes
2 answers
92 views

Subsetting a matrix returns a vector not a matrix

Using the below code, I am trying to subset the id matrix which has a dim of 100,000*27. The code below keeps rows that have values of 1,3 and 5. The subsetting is successful but what I got (id13) is ...
Nader Mehri's user avatar
0 votes
1 answer
35 views

How to add a value across rows for a column sample based on a condition

I have two dataset and I want to do this: dput(gt_df) structure(list(rs1 = c(1, 1), rs2 = c(0, 0), rs8 = c(1, 1), rs21 = c(0, 0)), row.names = c("1117F", "1XZ7S"), class = "...
rheabedi1's user avatar
0 votes
1 answer
38 views

How to subset a generated list as it works its way through iterations of tidyverse imap function?

In the below simplified example code, using the tidyverse imap() function I'm trying to get the "Inflow" columns of the matrixes generated after the first matrix of the same sublist group to ...
Curious Jorge - user9788072's user avatar
1 vote
2 answers
47 views

subset a matrix by a expression with a column name

data<- matrix(c(1,2,3,4,5,6,7,8,9), nrow=3) colnames(data) <- c("a", "b", "c") How can we achieve the following for a matrix when the columnname (b) must be in the ...
Mike Zhang's user avatar
0 votes
1 answer
88 views

Subset a dataframe to include samples from another file

I currently have a count matrix data.frame where the rownames are the genes and the colnames are the sample names head(colnames(countmatrix_clean_cl_mouse)) [1] "UB01.31YE" "UT38.78EE&...
mmpp's user avatar
  • 123
10 votes
8 answers
634 views

Select matrix rows that are permutations of a given vector

I have a matrix X: one two three four [1,] 1 3 2 4 [2,] 2 0 1 5 [3,] 3 2 1 4 [4,] 4 9 11 19 [5,] 4 3 2 1 I want to get a new matrix Y which only contains ...
Ricardo's user avatar
  • 103
3 votes
1 answer
132 views

Removing columns from a "big.matrix" gives error: "cannot allocate vector of size 37.6 Gb" [duplicate]

I have a large "big.matrix" and I need to remove a few columns from it. It was created from a CSV file (with 72 million rows) using BigMat <- read.big.matrix("matrix.csv", type=&...
fil0607's user avatar
  • 101
0 votes
2 answers
82 views

How to use R's loop to get the part of the aggregate matrix other than the many subset matrices?

I have two matrices of pure numbers, and their format is the same: the first column is the group name, the second is the starting number, and the third is the ending number. Each group is the name of ...
di pan's user avatar
  • 15
0 votes
1 answer
32 views

Replacing elemnts of an R matrix using a location matrix in R

In the following example i am trying to replace some elements of a two columns matrix m using a two column matrix containing row and columns positions. bbb [,1] [,2] [1,] 21 1 [2,] 15 ...
Badih's user avatar
  • 1
3 votes
2 answers
406 views

Choose odd rows and columns from an original matrix [duplicate]

I'm trying to get the elements from odd rows and columns of a matrix. With the matrix being: a = rbind(c(NA,2,-1,-2), c(0,1,3,0), c(0,NA,0,-1),c(3,1,5,NA)) I'm trying to get: [,1] [,2] [1,] NA ...
user avatar
0 votes
1 answer
33 views

How to match two column values in df1 and extract corresponding values in R

Table 1: Pos Samples 129 ERR5678 460 ERR7890 568 ERR7689 Table 2: Pos ERR5678 ERR7890 ERR7689 129 67890 76879 67894 460 56782 123478 678390 568 78926 890765 345678 Result Table Pos Samples Dp_value ...
codelearner's user avatar
-1 votes
1 answer
128 views

Selecting a subset of columns in a matrix using values stored in another matrix in Python

I am trying to subset a matrix by using values from another smaller matrix. The number of rows in each are the same, but the smaller matrix has fewer columns. Each column in the smaller matrix ...
mconsidine's user avatar

15 30 50 per page
1
2 3 4 5
12