several plotting questions

10 views
Skip to first unread message

squid

unread,
Mar 27, 2009, 4:45:49 PM3/27/09
to ggplot2
Hi,
I have data in the format

IDa IDa IDa IDa IDa
A B Delta Size Call
1 2347.13522 1545.10849 0.603193 10.8951 het
2 1528.74092 1335.95245 0.194475 10.4809 het
3 1463.58319 882.08367 0.730517 10.15 het
4 1417.2851 1334.87344 0.086427 10.4257 het
5 1891.65469 1179.06764 0.682002 10.5444 het
6 2912.81664 619.66734 2.23285 10.3918 T
7 1762.3923 570.72714 1.62666 9.96999 T
.....

etc...for quite a lot more Rows. I also have about 400,000 of these
datasets to examine, many of them I'd like to examine visually using

qplot(A,B, colour=Call)
qplot(Delta, Size, colour=Call)

The first header row, which in this set of data = ID1, will be
ID1-400,000.
So, here are my questions. I need to accommodate having two header
rows, so I'm looking first by header row 1, and then doing qplot by
header row 2.
And then I want to automate this to dump images to a file for at least
some subset of the data. I have no experience with loops in R and so
the more precise the suggestions, the better.
Thanks very much for any help.

Just to be clear, currently, these data are all in one file. So
imagine the table above printed 400K more times to the right (with
slightly different values in each version).

Many thanks.

hadley wickham

unread,
Mar 28, 2009, 9:21:30 PM3/28/09
to squid, ggplot2

It will be much easier to work with this data in a different format,
where the group is explicitly given as a grouping variable. Then you
can do things like

pdf("alloutput.pdf")
d_ply(mydata, .(group), function(df) {
qplot(A, B, data = df)
}, .print = TRUE)
dev.off()

to print all of the plots to a file. You might be able to use the
reshape package (http://had.co.nz/reshape) to get your data into this
format, all though the sheer size will make it difficult.

Hadley

--
http://had.co.nz/

squid

unread,
Mar 31, 2009, 3:33:30 PM3/31/09
to ggplot2
I broke the data down as you suggested and this worked great. Many
thanks!! Great software.
I'll look into reshape for printing to a single file (I was able to
print 1000 of them within about 10 minutes, but could not handle
400,000 of them).



On Mar 28, 9:21 pm, hadley wickham <h.wick...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages