[R] How to store the p value and number of events into a matrix

Rolf Turner rolf.turner at xtra.co.nz
Wed Feb 8 22:24:47 CET 2012


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



More information about the R-help mailing list