[R] Stats question: Comparison of the same individuals during two exposure times

2012-07-17 Thread natalie.vanzuydam
Hi, I'm hoping that someone will be able to help. I would like to compare how covariates associate with the risk of a binary outcome during two periods. Period 1 will be non-exposure to a treatment and period 2 will be exposure to a treatment. The same individuals will be examined in each group

[R] Subsetting a data frame

2011-12-05 Thread natalie.vanzuydam
Hi R users, I really need help with subsetting data frames: I have a large database of medical records and I want to be able to match patterns from a list of search terms . I've used this simplified data frame in a previous example: db <- structure(list(ind = c("ind1", "ind2", "ind3", "ind4")

Re: [R] Subsetting a data frame with multiple values and exclusions.

2011-10-06 Thread natalie.vanzuydam
Thanks. Such a short and sweet answer that does what it should. - Natalie Van Zuydam PhD Student University of Dundee nvanzuy...@dundee.ac.uk -- View this message in context: http://r.789695.n4.nabble.com/Subsetting-a-data-frame-with-multiple-values-and-exclusions-tp3874967p3877472.html Sen

[R] Subsetting a data frame with multiple values and exclusions.

2011-10-05 Thread natalie.vanzuydam
Hi all, I realise that the convention is to provide a working example of my problem but the data are of a sensitive nature so I'm not able to do that in this case. I need to query a database for multiple search terms: db <- structure(list(ind = c("ind1", "ind2", "ind3", "ind4"), test1 = c(1, 2

[R] Multiple events Cox's model and proportional hazards

2011-09-01 Thread natalie.vanzuydam
Hi, I am using the survival package to perform a Cox's regression analysis on multiple events of myocardial infarctions. I have been using the Andersen and Gill model: coxph(Surv(time1,time2,status)~factor(treatment)+age+sex+cluster(id). I was just wondering if this model should satisfy proport

[R] Cox's regression analysis with Left truncated data

2011-07-25 Thread natalie.vanzuydam
Hi, I have a fairly simple question. I would like to use the survival package to perform an analysis on data where an event can have occurred before individuals were recruited into a study. I'm not sure how to do this using the Surv() function. I would have a date of an event and then the enrol

[R] within group sequential subtraction

2011-03-10 Thread natalie.vanzuydam
Hi Everyone, I would like to do sequential subtractions within a group so that I know the time between separate observations for a group of individuals. My data: data <- structure(list(group = c("IND1", "IND1", "IND2", "IND2", "IND2", "IND3", "IND4", "IND5", "IND6", "IND6"), date_obs = struc

Re: [R] Cleaning date columns

2011-03-10 Thread natalie.vanzuydam
Dear Bill, Thanks very much for the reply and for the code. I have amended my personal details for future posts. I was wondering if there were any good books or tutorials for writing code similar to what you have provided above? Best wishes, Natalie Van Zuydam - Natalie Van Zuydam PhD Stu