coxed icon indicating copy to clipboard operation
coxed copied to clipboard

Problem with `mutate()` input `y`

Open jkropko opened this issue 3 years ago • 1 comments

Dear Mr. Harden, dear Mr. Kropko

I am working with your command sim.survdata( ) from the coxed package in R. I have just encountered a strange error involving the command mutate( ). You could find my code and the error message below.

It seems that sim.survdata does not work when I want to consider only one regressor with time-varying coefficients.

Do you have an idea how to fix this?

In any case, thank you for writing the command, it helps a lot.

R Code

simdata <- sim.survdata(N=100, T=100, type="tvbeta", xvars=1, beta=as.matrix(rnorm(50,0,1)), num.data.frames=1)

Error Message

Error: Problem with mutate() input y. x Input y can't be recycled to size 100. i Input y is lifetimes. i Input y must be size 100 or 1, not 5000. Run rlang::last_error() to see where the error occurred.

jkropko avatar Mar 08 '21 18:03 jkropko

Hi, jkropko, a couple of months ago, I got the same problem, and I had reviewed the source code to locate where the problem was. Please refer to the first issue, I hope the author to provide some possible soulution. Thanks a lot.

yellowbridge avatar Mar 15 '21 01:03 yellowbridge