[R] Reading hierarchical data
Saba(Home)
sabaric at charter.net
Sun Feb 7 16:57:16 CET 2010
I would like to read the following hierarchical data set. There is a family
record followed by one or more personal records.
If col. 7 is "1" it is a family record. If it is "2" it is a personal
record.
The family record is formatted as follows:
col. 1-5 family id
col. 7 "1"
col. 9 dwelling type code
The personal record is formatted as follows:
col. 1-5 personal id
col. 7 "2"
col. 8-9 age
col. 11 sex code
The first six family and accompanying personal records look like this:
06470 1 1
1 232 0
2 230 1
07470 1 0
1 240 1
08470 1 0
1 227 0
09470 1 0
1 213 1
2 222 0
3 224 1
10470 1 1
1 220 0
2 211 1
11470 1 0
1 217 0
2 210 1
3 226 1
I want to create a dataset containing
. family ID
. dwelling code
. person ID
. age
. sex code
The dataset will contain one observation per person, and the with family
information repeated for people in the same family.
Can anyone help?
Thanks,
Richard Saba
More information about the R-help
mailing list