[R] How to merge two tables
Jim Lemon
drjimlemon at gmail.com
Tue Feb 23 08:30:27 CET 2016
Hi Xiyan,
It looks like your tables have different numbers of cases. There are:
66 DEAD FEMALES in "cross"
56 DEAD FEMALES in "age"
48 NON-DEAD FEMALES in "cross"
58 NON-DEAD FEMALES in "age"
and so on. Perhaps there is some mistake with the counts. If this is the
problem you could expand the counts to individual lines in a merged data
frame using the sex and death information.
Jim
On Tue, Feb 23, 2016 at 5:46 AM, Xiyan Lon <xiyanlon at gmail.com> wrote:
> Dear all,
> I am currently studying categorical data analysis, if I have two tables:
>
> R> cross
> sex cross death count
> 1 FEMALE WEF YES 26
> 2 MALE WEF YES 14
> 3 FEMALE OGG YES 32
> 4 MALE OGG YES 43
> 5 FEMALE TGA YES 8
> 6 MALE TGA YES 10
> 7 FEMALE WEF NO 6
> 8 MALE WEF NO 7
> 9 FEMALE OGG NO 26
> 10 MALE OGG NO 12
> 11 FEMALE TGA NO 16
> 12 MALE TGA NO 26
>
> R> age
> sex age death count
> 1 FEMALE 17Y YES 16
> 2 MALE 17Y YES 4
> 3 FEMALE 18Y YES 40
> 4 MALE 18Y YES 51
> 5 FEMALE 17Y NO 32
> 6 MALE 17Y NO 42
> 7 FEMALE 18Y NO 26
> 8 MALE 18Y NO 15
>
> - How to merge two tables.
> - How to expand both tables such as:
>
> sex age cross death
> FEMALE 17Y WEF YES
> ...
> FEMALE 18Y TGA NO
>
>
> Warm regards,
> Xiyan Lon
>
> This email has been sent from a virus-free computer protected by Avast.
> www.avast.com <https://www.avast.com/sig-email>
> <#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]
More information about the R-help
mailing list