[R] Multiple ecdf plots?
David Winsemius
dwinsemius at comcast.net
Fri Jun 18 06:03:18 CEST 2010
On Jun 17, 2010, at 4:46 PM, weller wrote:
>
> I have a csv file that has approximately 50k rows. In the first
> value of
> each row, a file name is listed, and there are 162 different file
> names. At
> the end of each row, there is a number value. What I would like to
> be able
> to do is for the 162 different files (or we could call them
> categories), is
> compute the ecdf for the values within that category. Then plot the
> ecdf
> for each file on the same graph. Essentially, it would look
> something like
> http://www-stat.stanford.edu/~jtaylo/courses/stats202/R/chap3_data_exploration/iris_ecdf.png
> ,
> but instead of the 3 lines, it would show 162. They don't have to be
> different colors, and the number of records in each file category
> changes.
> I was considering using a matrix and adding to it via a loop, but
> couldn't
> quite get it to work. This is what I have right now.
>
> thwop <- read.csv("real_unmod_estimated_pI.csv", header=TRUE)
> filelist <- levels(thwop$Source)
> rig=matrix(nrows=162)
>
> for (i in filelist)
> {
> thug <- subset(thwop, == i)
> rig[i,length(ecdf(thug$Estimated.pI))]=ecdf(thug$Source)
> }
> rig
Perhaps:
plot(x=0, y=min(thwop$estimated.pI), xlim=c(min(thwop$estimated.pI),
max(thwop$estimated.pI) ), ylim=c(0.0, 1.0), xlab="", ylab="")
tapply(thwop$estimated.pI, thwop$Source, function(x) { par(new=TRUE) ;
plot(ecdf(x), verticals=TRUE, xlim=c(min(thwop$estimated.pI), max(thwop
$estimated.pI, xaxt=FALSE) )) })
(It is going to be a mess.)
>
> Any help would be appreciated
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Multiple-ecdf-plots-tp2259465p2259465.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list