I would recommend the following :
a) create new factor variables out of the original factor variables
(Condition_1, Condition_2, ..., Condition_n) to
reflect the analyses that you want to do. The builtin function
"interaction" will do this for any number of factors
b) use the "summary" function from package Hmisc to automatically
create the descriptive statistics for each level of
the newly created factors. This function will create latex versions of the
table, customize presentation (e.g. number of digits) and even
run statistical comparisons depending on the type of outcome variable specified.
It can also create "TeX" versions of these tables which
can be imported (e.g. through htlatex) to MSWord and OpenOffice.
Cheers,
Christos Argyropoulos
> From: ruijie@gmail.com
> Date: Sat, 1 May 2010 01:04:19 +0800
> To: r-help@r-project.org
> Subject: [R] deriving mean from specific cases
>
> Hi all,
>
> I have a large dataset that has >10k entries. The dataset is stored in a
> dataframe with the headers:
>
> SubID Condition1 Condition2 Result1 Result2
>
> There are multiple entries for a given SubID(Subject ID). Condition 1 has 3
> levels and condition2 has 2 levels (therefore there are 6 possible
> combinations all together e.g. Cond1 Level1 x Cond2 Level 1 etc.) and i
need
> to compute for
> 1. The mean for a subject of result1 and 2 for all the permutations of
> condition 1 and 2.
> 2. The mean of all subjects for result1 and 2 split into the permutations
of
> condition 1 and 2.
>
> can anyone advise on how this can be accomplished in R? Some data
> reorganisation probably needs to be done.
>
> Thanks and by the way, this is my first foray into R and I have been a long
> time Excel user. Appreciate any guidance!
>
>
> Regards,
> RJ
>
> [[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.
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
[[alternative HTML version deleted]]