summer
2012-Feb-08 20:50 UTC
[R] How to store the p value and number of events into a matrix
Hi, there is p value and number of events from coxph results. How can I keep record of every p value and number of events automatically if I run 100 times? Another question is how can I change the true or faulse statment to 1 and 0. such as w=1<2, I want the value of w to be 1 not true. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/How-to-store-the-p-value-and-number-of-events-into-a-matrix-tp4370833p4370833.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2012-Feb-08 21:00 UTC
[R] How to store the p value and number of events into a matrix
On Feb 8, 2012, at 3:50 PM, summer wrote:> Hi, there is p value and number of events from coxph results. How > can I keep > record of every p value and number of events automatically if I run > 100 > times??replicate> Another question is how can I change the true or faulse statment to > 1 and 0. > such as w=1<2, I want the value of w to be 1 not true.That way lies madness. -- David Winsemius, MD West Hartford, CT
Rolf Turner
2012-Feb-08 21:24 UTC
[R] How to store the p value and number of events into a matrix
On 09/02/12 10:00, David Winsemius wrote:> > On Feb 8, 2012, at 3:50 PM, summer wrote: > >> Hi, there is p value and number of events from coxph results. How can >> I keep >> record of every p value and number of events automatically if I run 100 >> times? > > ?replicate > >> Another question is how can I change the true or faulse statment to 1 >> and 0. >> such as w=1<2, I want the value of w to be 1 not true. > > That way lies madness. >Very likely; but if you want to go mad, madness is easily achieved. Just add 0: w <- 0+(1<2) (Doing arithmetic on logical vectors coerces them to numeric vectors of zeroes and ones.) cheers, Rolf Turner
David Winsemius
2012-Feb-08 21:47 UTC
[R] How to store the p value and number of events into a matrix
On Feb 8, 2012, at 4:24 PM, Rolf Turner wrote:> On 09/02/12 10:00, David Winsemius wrote: >> >> On Feb 8, 2012, at 3:50 PM, summer wrote: >> >>> Hi, there is p value and number of events from coxph results. How >>> can I keep >>> record of every p value and number of events automatically if I >>> run 100 >>> times? >> >> ?replicate >> >>> Another question is how can I change the true or faulse statment >>> to 1 and 0. >>> such as w=1<2, I want the value of w to be 1 not true. >> >> That way lies madness. >> > > Very likely; but if you want to go mad, madness is easily achieved. > Just > add 0: > > w <- 0+(1<2) > > (Doing arithmetic on logical vectors coerces them to numeric vectors > of zeroes and ones.) >Apologies if I misread the question. My comment about the path to madness came from me parsing of its language as requesting that 1 == not-true and 0 == TRUE.> cheers, > > Rolf TurnerDavid Winsemius, MD West Hartford, CT