Your friends are: na.omit and is.na The easiest way (I think) will be to have your data.frame organized so you have a row for each subject. and on the row, you check the outcome variables with "is.na" and create a subset of your data from that. And on that data, run your tests...
Tal ----------------Contact Details:------------------------------------------------------- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Wed, Feb 24, 2010 at 11:19 AM, <denis.ay...@unibas.ch> wrote: > Hi everyone > > I have the following problem: My dataframe has 3 variables: ID, Year and > and an outcome variable. The dataframe contains repeated measurements > because the subjects filled out a questionnaire every year. The time span > covers 2 years. > > Now I want to check if there is a significant change in the outcome over > the 2 years with a paired wilcox.test. The problem: Not every subject > completed both questionnaires. Thus, some subjects have the outcome only > for year1 and others only for year2. > > If I try wilcox.test(Outcome~Year, paired=T), I receive an error "not the > same length". > > Is there a fast method to remove those subjects with missing outcomes? > > Thanks for any help. > > Regards, > Denis Aydin > > _____________________________________________ > > Denis Aydin, MSc > > Swiss Tropical and Public Health Institute > Socinstrasse 57, P.O. Box > 4002 Basel, Switzerland > > T +41 (0)61 270 22 04 > F +41 (0)61 270 22 25 > @ denis.ay...@unibas.ch > > _____________________________________________ > > Postal address: > > Denis Aydin, MSc > Swiss Tropical and Public Health Institute > Socinstrasse 57, P.O. Box > 4002 Basel, Switzerland > > Visitors address: > > Kanonengasse 27 > 4051 Basel, Switzerland > > _____________________________________________ > > Swiss TPH website: www.swisstph.ch > > Former ISPM: www.ispm-unibas.ch > Former STI: www.sti.ch > > > > -------------------------------------------------------------------------- > This email and any files transmitted with it are confide...{{dropped:8}} > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.