Jenkins, Helen
2009-Jun-28 17:02 UTC
[R] Fold function with several time varying covariates
Hi I'm trying to use the fold function as described here: http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-cox-regression.pdf Page9 It does say that you can use this when you have more than one time varying covariate: in the description of the argument cov it says: "cov: A vector giving the column numbers of the time-dependent covariate in data, or a list of vectors if there is more than one time-dependent covariate." But I'm struggling with the syntax to list these vectors (I have 3 time varying covariates). I've tried "cov=list(10:20,21:31,32:42)" But this just gives me an error message. Does anyone know how I can list my vectors in the context? Thanks Helen
Allan Engelhardt
2009-Jun-29 13:19 UTC
[R] Fold function with several time varying covariates
On 28/06/09 18:02, Jenkins, Helen wrote:> But this just gives me an error message. >What error message?
Bjarke Christensen
2009-Jun-30 12:57 UTC
[R] Fold function with several time varying covariates
Helen, You are asking for help with a function which is not part of R, and your question is nowhere nearly detailed enough to make it possible to replicate the error. However, if the function you are using is the one available in http://cran.r-project.org/doc/contrib/Fox-Companion/app-scripts.zip and my guess as to what commands you entered in order to produce the error is correct, then your problem is most likely that you are entering cov.names as a list instead of a character vector. An example: you might be typing cov.names = list('age', 'gender', 'occupation') when you should be typing cov.names = c('age', 'gender', 'occupation') According to the documentation for the function I think you may be using, cov should be a list of vectors, while cov.names should be a character vector containing the names of each covariate. I hope this helps - if it doesn't, you might try posting a self-contained example (code) that we can try on our systems and that will provoke the same error. Bjarke Christensen. Helen Jenkins wrote:>The error message when I use list is: >" s.matrix(!is.na(new.data[, cov.names])) : > invalid subscript type 'list'"