[R] The variables combined in a table from other table and combination questions

Stephen Weigand weigand.stephen at gmail.com
Fri Sep 7 04:47:48 CEST 2007


On 9/5/07, leeznar at yahoo.com.tw <leeznar at yahoo.com.tw> wrote:
> Dear All:
> I need to have some data frame objects.
> First aa object:
>    pH  Formulation  time  Subject
> [1]1.2  F           0       1
> [2]7.4  S           1       2
> [3]    MF           2       3
> [4]                 3       4
> [5]                 n        i
> Then, I need to produce 2*3(pH*formulation) different
> tables.  This table includes column of (pH,
> Formulation, time  S1  S2  S3 ¡K..Si) and S1= subject
> 1, S2=subject 2 and so on.  For example: bb1 table
>    pH  Formulation  time  S1  S2  S3¡K.Si
> [1]1.2  F           0
> [2]                 1
> [3]                 2
> [4]                 3
> [5]                 n
>
> For example: bb2 table
>    pH  Formulation  time  S1  S2  S3¡K.Si
> [1]1.2  S           0
> [2]                 1
> [3]                 2
> [4]                 3
> [5]                 n
>
>
> Moreover, the values of pH and Formulation column are
> the combination questions.  The values of pH and
> Formulation column should be the combinations such as
> (1.2, F), (1.2, S), (1.2, MF), (7.4, F), (7.4, S),
> (7.4, MF)
> I am a beginner level in R and I have no idea how to
> do this. Could any one please help me.  Thanks a
> lot!!!
>
> Best regrards
> Hsin Ya Lee
>

I don't understand exactly what you want but perhaps start with this:

expand.grid(pH = c(1.2, 7.4), Formulation = c("F", "S", "MF"))

Hope this helps,

Stephen

-- 
Rochester, Minn. USA



More information about the R-help mailing list