[R] scatterplot and correlation for weird data format

William Simpson william.a.simpson at gmail.com
Mon Feb 16 17:21:21 CET 2009


I have data in a format like this:

name	ssex	sex	view	num	rating	rt
ahl4	f	m	f	56	-108	2246
ahl4	f	m	f	74	85	1444
ahl4	f	m	f	52	151	1595
ahl4	f	m	f	85	1	1447
ahl4	f	m	f	53	46	1716
ahl4	f	m	f	37	145	1276
ahl4	f	m	f	50	98	1465
ahl4	f	m	f	51	-26	1322
ahl4	f	m	f	38	-97	1790
ahl4	f	m	f	14	-158	865
...
ahl4	f	m	p	43	-136	1669
ahl4	f	m	p	10	-59	808
ahl4	f	m	p	67	-111	1279
ahl4	f	m	p	85	-86	994
ahl4	f	m	p	100	134	1337
ahl4	f	m	p	76	56	665
ahl4	f	m	p	51	-49	594
ahl4	f	m	p	33	-118	505
ahl4	f	m	p	49	-156	1283
...
and so on for many subjects (name)

I would like to do a scatterplot of the rating given by each subject
(with identifier "name") for the frontal (view=="f") and profile
(view=="p") views of each face (each face has an identifier "num").
I'd like to find the correlation as well.
For each subject, since there are 100 faces, there will be 100 points
on the scatterplot. I would just lump all the subjects' data together
for the plot and correlation I think (unless somebody tells me I
should do each subject separately).

I'm stumped on how to do this. Thanks very much for any help!

Bill




More information about the R-help mailing list