rowsum Questions

6

Solved

ID <- 1:6 math <- c("YES","NO","YES","NO",NA,NA) history <- c(NA,NA,"NO","NO","YES",NA) dt <- data.frame(ID, math,...
Ea asked 10/6, 2022 at 8:47

7

I have a very large dataframe with rows as observations and columns as genetic markers. I would like to create a new column that contains the sum of a select number of columns for each observation ...
Digressive asked 21/10, 2010 at 21:2

4

Solved

I have a data frame of values across successive years (columns) for unique individuals (rows). A dummy data example is provided here: dt = structure(list(ID = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), `201...
Mckenna asked 25/3, 2022 at 8:7

4

Solved

I'm quite new to R and this is the first time I dare to ask a question here. I'm working with a dataset with likert scales and I want to row sum over different group of columns which share the fir...
Rosamondrosamund asked 21/5, 2015 at 20:59

3

For the base R matrix class we have the rowsum function, which is very fast for computing column sums across groups of rows. Is there an equivalent function or approach implemented in the Matrix-p...
Entomo asked 25/6, 2018 at 14:33

2

Solved

I want to calculate rowMeans of a range of column but I cannot give the hard-coded value for colnames (e.g c(C1,C3)) or range (e.g. C1:C3) as both names and range are variable. My df looks like: &...
Viscosity asked 27/7, 2016 at 16:5

2

Solved

I'm fairly new to R and I'm trying to sum columns by groups based on their names. I have a data frame like this one: DT <- data.frame(a011=c(0,10,20,0),a012=c(010,10,0,0),a013=c(10,30,0,10), a0...
Guss asked 17/8, 2015 at 14:16

2

I am trying to count a binary character outcome by row in a large data frame: V1 V2 V3 V4 V5 Loss Loss Loss Loss Loss Loss Loss Win Win Loss Loss Loss Loss Loss Loss Reprex: df <- data.frame( ...
Acoustics asked 8/1, 2015 at 21:45

1

Solved

Hello and thank you in advance for your assistance, (PLEASE Note Comments section for additional insight: i.e. the cost column in the example below was added to this question; Simon, provides a gr...
Deaconry asked 10/4, 2013 at 18:47

2

Solved

I need to extend this question, which sums values of an array based on indices from a second array. Let A be the result array, B be the index array, and C the array to be summed over. Then A[i] = s...
Sound asked 7/4, 2013 at 16:8

5

So I am trying to sum the rows of a matrix, and there are inf's within it. How do I sum the row, omitting the inf's?
Syndicate asked 13/3, 2013 at 18:12

4

Solved

I am having quite a tricky problem, which i just cannot seem to solve. I have a large dataset (23277 rows, 151 columns). Each column has values from 0:100 (inclusive) representing probabilities as...
Unipersonal asked 15/5, 2011 at 19:34

4

Solved

Consider the array a: > a <- array(c(1:9, 1:9), c(3,3,2)) > a , , 1 [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 , , 2 [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 How do we ...
Parimutuel asked 27/2, 2011 at 19:36
1

© 2022 - 2024 — McMap. All rights reserved.