[R] Boxplot of multiple vectors with different lengths
gunter.berton at gene.com
Mon Dec 12 23:05:23 CET 2011
Sorry -- previous versiuon prematurely sent. Full version is:
Yikes! You should never have to do this sort of thing (writing stuff
out to files, etc.)
What is wanted, I believe, is ?do.call as in
where z is list(a,b,c) as Sarah described.
However, I think you might do even better in terms of controlling
options, labels, etc. if you would get the data into standard flat
file format (data frame) as
(This is easy to do in R and via many packages.)
and then use he formula interface in the lattice ?bwplot function for th eplot.
> On Mon, Dec 12, 2011 at 1:43 PM, Thomas Adams <thomas.adams at noaa.gov> wrote:
>> I think you could do what you want by having the vector data written to
>> separate files; then create a file containing the individual file names. In
>> R, read the file containing the list of file names and loop through this
>> reading in the individual vector files. Maybe this is an inelegant, brute
>> force approach, but it has worked for me with essentially the same problem.
>> On Mon, Dec 12, 2011 at 4:24 PM, Ryan Utz <utz.ryan at gmail.com> wrote:
>>> I'm attempting to write a code that automatically imports data from
>>> different files (with different lengths-just one variable) and makes tidy
>>> box plots for comparison. I can successfully import the data and create a
>>> list of the vectors I want to compare. But I cannot, for the life of me,
>>> figure out how to generate box plots using the "list" option. Suppose these
>>> are my data:
>>> And this is my list of the vectors I'm interested in:
>>> Well, this successfully generates the kind of boxplot I want:
>>> But this does not:
>>> Because I'm trying to write an automatic plot-generator as the amount of
>>> data I'm working with will typically vary, I need to write this to handle
>>> any number of data vectors.
>>> I've tried every imaginable means of tweaking the name of "z", with zero
>>> success. And I've scoured the help pages for about 45 minutes (just to
>>> preempt any "read the help" responses). Please help!
>>> Ryan Utz, Ph.D.
>>> Aquatic Ecologist/STREON Scientist
>>> National Ecological Observatory Network
>>> Home/Cell: (724) 272-7769
>>> Work: (720) 836-2488
>>> [[alternative HTML version deleted]]
>>> R-help at r-project.org mailing list
>>> PLEASE do read the posting guide
>>> and provide commented, minimal, self-contained, reproducible code.
>> Thomas E Adams
>> National Weather Service
>> Ohio River Forecast Center
>> 1901 South State Route 134
>> Wilmington, OH 45177
>> EMAIL: thomas.adams at noaa.gov
>> VOICE: 937-383-0528
>> FAX: 937-383-0033
>> [[alternative HTML version deleted]]
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> Bert Gunter
> Genentech Nonclinical Biostatistics
> Internal Contact Info:
> Phone: 467-7374
Genentech Nonclinical Biostatistics
Internal Contact Info:
More information about the R-help