Hello, I have somewhat of a weird data set and am attempting to create a barplot with it. I have 8 columns with different variables and their percentages. I have 1 column with representations of 4 different treatments the variables undergo. I also have 1 column with year the data was recorded. I want to create a bar plot that plots all 8 variables grouped by treatment and year. I've tried creating subsets of each of the variables, no luck. My variables are arranged similar to this: Vascular.plants Solid.rock Gravel.and.cobbles 72.5 1.0 5 67.5 2.0 6 67.5 2.5 9 59.0 2.0 25 [[alternative HTML version deleted]]
On 10/07/2011 08:16 AM, Daniel Winkler wrote:> Hello, > > I have somewhat of a weird data set and am attempting to create a barplot > with it. > > I have 8 columns with different variables and their percentages. I have 1 > column with representations of 4 different treatments the variables undergo. > I also have 1 column with year the data was recorded. I want to create a bar > plot that plots all 8 variables grouped by treatment and year. > > I've tried creating subsets of each of the variables, no luck. > > My variables are arranged similar to this: > > Vascular.plants Solid.rock Gravel.and.cobbles > 72.5 1.0 5 > 67.5 2.0 6 > 67.5 2.5 9 > 59.0 2.0 25 >Hi Daniel, If you want the grouping indicated by nested bars, see the barNest function in the plotrix package. Jim
Hi, Another way to do that is with function barchart() in package lattice. Barchart requires a function which relates your variables with the option to specify groups. Check the examples (are under xyplot help) to apply them to your case. Regards, Carlos Ortega www.qualityexcellence.es On Thu, Oct 6, 2011 at 11:16 PM, Daniel Winkler <winkler.de@gmail.com>wrote:> Hello, > > I have somewhat of a weird data set and am attempting to create a barplot > with it. > > I have 8 columns with different variables and their percentages. I have 1 > column with representations of 4 different treatments the variables > undergo. > I also have 1 column with year the data was recorded. I want to create a > bar > plot that plots all 8 variables grouped by treatment and year. > > I've tried creating subsets of each of the variables, no luck. > > My variables are arranged similar to this: > > Vascular.plants Solid.rock Gravel.and.cobbles > 72.5 1.0 5 > 67.5 2.0 6 > 67.5 2.5 9 > 59.0 2.0 25 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
Apparently Analagous Threads
- data messed up by read.table ? (PR#9779)
- getting elements out of list automatically
- trying to get better ogg quality for this clip
- Determining Starting Values for Model Parameters in Nonlinear Regression
- Determining Starting Values for Model Parameters in Nonlinear Regression