Displaying 2 results from an estimated 2 matches for "cdem".
Did you mean:
cde
2011 Nov 28
2
Retain parts of a matrix
...final results to be a matrix with both the values that meet the
criteria (the results of the function), and those that to do in the same
positions in the matrix (the original numbers).
Here's a sample of what I would like to do:
t.mean.1.c <- c(-15, -20, -30, -20, -25, -35, -40, -8, 9, 10)
cdem <- c(300, 400, 700, 900, 1000, 250, 200, 300, 500, 650, 650, 1200,
1400, 3200, 2000)
cdem.mat <- matrix(NA, 10, 15)
cdem.mat <- cdem.mat(sapply(cdem[which(cdem >= 900)], function(x)
get("t.mean.1.c") - (x * -0.0065)))
I want cdem.mat to be the same size as the the first call...
2011 Nov 29
1
Sum matrix by rows, conditional on value
I'd like to sum a matrix only where the matrix meets a specific condition.
The matrix has 365 rows and about 50,000 columns.
str(cdem.mat.yr)
num [1:365, 1:41772] -43.5 -48.4 -45.9 -38.4 -32 ...
I'm having trouble replicating this because it is not working out for me,
so I'm unsure I can provide an solid working example (apologies).
I would like to subset my matrix where the values are greater than zero. I
can do this...