[R] Extracting a subset

Silvano silvano at uel.br
Mon May 10 17:03:44 CEST 2010


Hi,

I used

#------------------
# Análise do PESO -
#------------------
 pesom1 = cbind(PESO[MÊS==1])
 pesom3 = cbind(PESO[MÊS==3])

#--------- Grupo Placebo ---------
 pesom1p = pesom1[GRUPO=='P']
 pesom3p = pesom3[GRUPO=='P']
 t.test(pesom1p, pesom3p, paired=T)

#--------- Grupo Cogumelo ---------
 pesom1c = pesom1[GRUPO=='C']
 pesom3c = pesom3[GRUPO=='C']
 t.test(pesom1c, pesom3c, paired=T)

to compare PESO between MÊS (Months) inside GRUPO 
(t-paired). CICLO was fixed.


But, I have two CICLOS, and I would like compare PESO 
between MÊS==3 (CICLO 3) and MÊS==6 (CICLO 6) inside GRUPO 
(1 and 2).

My file has (part of data):

Ciclo   Mês     Grupo   Peso
3   0   1   62.2
3   0   1   67.0
3   0   1   71.5
3   0   2   70.0
3   0   2   71.0
3   0   2   69.5
3   1   1   60.0
3   1   1   51.2
3   1   1   70.0
3   1   2   59.0
3   1   2   56.5
3   1   2   70.0
3   2   1   68.0
3   2   1   69.0
3   2   1   66.0
3   2   2   56.0
3   2   2   53.0
3   2   2   96.0
3   3   1   67.0
3   3   1   70.0
3   3   1   67.0
3   3   2   71.5
3   3   2   70.0
3   3   2   71.0
6   0   1   66.2
6   0   1   65.0
6   0   1   73.5
6   0   2   78.0
6   0   2   71.0
6   0   2   62.5
6   1   1   63.0
6   1   1   51.2
6   1   1   72.0
6   1   2   59.0
6   1   2   57.5
6   1   2   79.0
6   2   1   78.0
6   2   1   66.0
6   2   1   63.0
6   2   2   52.0
6   2   2   54.0
6   2   2   93.0
6   3   1   62.0
6   3   1   71.0
6   3   1   63.0
6   3   2   78.5
6   3   2   75.0
6   3   2   74.0
6   4   1   63.2
6   4   1   62.0
6   4   1   73.5
6   4   2   73.0
6   4   2   72.0
6   4   2   65.5
6   5   1   67.0
6   5   1   57.2
6   5   1   70.0
6   5   2   59.0
6   5   2   56.5
6   5   2   71.0
6   6   1   61.0
6   6   1   61.0
6   6   1   61.0
6   6   2   52.0
6   6   2   53.0
6   6   2   96.0

--------------------------------------
Silvano Cesar da Costa
Departamento de Estatística
Universidade Estadual de Londrina
Fone: 3371-4346
--------------------------------------
----- Original Message ----- 
From: "Ivan Calandra" <ivan.calandra em uni-hamburg.de>
To: <r-help em r-project.org>
Sent: Monday, May 10, 2010 11:26 AM
Subject: Re: [R] Extracting a subset


Hi,
My first suggestion would be to supply a sample data (maybe 
using the
function dput) showing what you have, what you want to do, 
and what
you've tried (you say that subset() didn't work but we don't 
know how
you've typed it).
Then, we'll see!
Ivan



Le 5/10/2010 14:35, Silvano a écrit :
> Hi,
>
> I have a dataset with many variables and observations.
> The variable Group has two levels: C and P,
> the Month variable has four levels: 0, 1, 2 and 3.
>
> I want to extract a subset of the variable Weight, 
> considering only 1 and 3 levels for Months of the Group 
> variable.
>
> I tried the command subset but it did not work. Any 
> suggestions?
>
> Thanks,
>
> --------------------------------------
> Silvano Cesar da Costa
> Departamento de Estatística
> Universidade Estadual de Londrina
> Fone: 3371-4346
>
> ______________________________________________
> R-help em 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.
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra em uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php

______________________________________________
R-help em 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.



More information about the R-help mailing list