Displaying 2 results from an estimated 2 matches for "expectedresult".
2010 Oct 05
3
Question about assigning values in a matrix, conditional on column first row; how to do the loop.
...I could not perform the task. Here it is an example of a small matrix and the expected result, but the original has more rows and columns.
> matr <- matrix(c(0.1,1,0,2,0.5,1,2,2), nrow=4, ncol=2)
> matr
[,1] [,2]
[1,] 0.1 0.5
[2,] 1.0 1.0
[3,] 0.0 2.0
[4,] 2.0 2.0
> matr.expectedresult= matrix(c(0.1,-999,-999,0.1,0.5,-999,0.5,0.5), nrow=4, ncol=2)
> matr.expectedresult
[,1] [,2]
[1,] 0.1 0.5
[2,] -999.0 -999.0
[3,] -999.0 0.5
[4,] 0.1 0.5
Thank you very much
Paula
2014 Oct 07
1
Conditional Data Manipulation -Cumulative Product
...8
1.46
0.81
1/12/2014
1.51
0.78
1.63
0.46
1.84
1/13/2014
0.26
0.34
0.34
0.97
1.13
StopSignals:
Date
Stop
1/1/2014
0
1/2/2014
0
1/3/2014
1
1/4/2014
0
1/5/2014
1
1/6/2014
0
1/7/2014
0
1/8/2014
1
1/9/2014
0
1/10/2014
0
1/11/2014
0
1/12/2014
0
1/13/2014
1
ExpectedResult:
Date
X1
X2
X3
X4
X5
1/1/2014
0
0
0
0
0
1/2/2014
0
1.51
0
0
1.24
1/3/2014
0
0.14
0.2
0
0.37
1/4/2014
0
0
0
0
0
1/5/2014
1.04
0
0
0
1.23
1/6/2014
0
0
0.76
0
0
1/7/2014
0
0
0.93
0.66
0
1/8/2014
0
0
0.25
0.06
0
1/9/2014
0
0
0
0
0
1/10/2014...