[R] Plotting and quantiles

Mark D. d.mark55 at ymail.com
Sat Aug 13 16:10:49 CEST 2011


Dear R users,


This is most likely very basic question but I am new to R and would really appreciate some tips on those two problems.

1) I need to plot variables from a data frame. Because of some few high numbers my graph is really strange looking. How could I plot a fraction of the samples (like 0.1 (10%), 0.2 up to for example 0.6) on x axis and values 'boundaries' (like any value '< 100',  '101-200' and '> 201') on the y axis? This needs to be a simple line plot like the one I attached for an example. The values would come from one column.


2) I have a data frame with values and need to subset the rows based on the values. I wanted to order them (with increasing values) and divide into 3-4 groups. I though about using quantile but I want the group to be something like '1-25', '26-50', '51-75', '75-100' (ordered and for example 25th percentile, 26-50th etc). I could just look for a median divide into two and then again (or use quantiles 0.25, 0.5, 0.7 and 1 and then get rid of all rows in 0.25 that are in 0.5 etc) but surely there must by a faster and simpler way to do that (I need to do this a lot on different columns)?

Thanks for your help,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: viewer.png
Type: image/png
Size: 6799 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110813/973e73ea/attachment.png>


More information about the R-help mailing list