Hello, I was hoping for some advice to resolve a problem I am having trouble with. The data consists of a series of pre and post variables, in a dataframe called 'offend'. I am interested in graphically depicting the pre & post values for a factor variable called 'decision' which has 4 values : nusm, fit, unsound & unfit. An example of a pre and post variable is: pre.damage and post.damage (data below). I wanted to exclude all values = 0, and collapse the remaining values into 3 categories .e.g 1, 2-5, 6 plus. For each 'decision' group the final graph would contain the alternating pre and post values for 'damage'. For example, for 'fit' the first bar would have a pre value = 18 & a post value = 4, the second pre bar would = 17 and the post bar = 2, and the third pre bar would = 2 & the post = 1. I have experimented with lattice, entering the values (e.g as per above), however I was hoping to find a solution to directly extract the data from the dataframe as I wanted to generate 16 such graphs. Any assistance is much appreciated, regards Bob Green > table(decision,pre.damage) pre.damage decision 0 1 2 3 4 5 6 7 8 9 10 11 13 14 20 fit 89 18 9 4 2 2 1 0 0 1 0 0 0 0 0 nusm 158 44 15 5 5 6 6 3 1 1 2 0 0 0 0 unfit 27 2 2 0 0 1 0 0 0 0 0 0 0 0 0 unsound 333 68 36 8 5 4 1 0 0 0 0 1 1 1 1 > table(decision,post.damage) post.damage decision 0 1 2 3 4 5 6 7 10 12 13 fit 119 4 1 1 0 0 0 0 1 0 0 nusm 212 16 11 2 0 2 1 1 0 1 0 unfit 31 1 0 0 0 0 0 0 0 0 0 unsound 441 8 5 3 1 0 0 0 0 0 1
On Dec 23, 2006, at 12:07 AM, Bob Green wrote: <snip>> The data consists of a series of pre and post variables, in a > dataframe > called 'offend'. I am interested in graphically depicting the pre & > post > values for a factor variable called 'decision' which has 4 values : > nusm, > fit, unsound & unfit. An example of a pre and post variable is: > pre.damage > and post.damage (data below). I wanted to exclude all values = 0, and > collapse the remaining values into 3 categories .e.g 1, 2-5, 6 plus. > > For each 'decision' group the final graph would contain the > alternating pre > and post values for 'damage'. For example, for 'fit' the first bar > would > have a pre value = 18 & a post value = 4, the second pre bar would > = 17 and > the post bar = 2, and the third pre bar would = 2 & the post = 1.<snip>> > table(decision,pre.damage) > pre.damage > decision 0 1 2 3 4 5 6 7 8 9 10 11 13 > 14 20 > fit 89 18 9 4 2 2 1 0 0 1 0 0 > 0 0 0 > nusm 158 44 15 5 5 6 6 3 1 1 2 0 0 > 0 0 > unfit 27 2 2 0 0 1 0 0 0 0 0 0 > 0 0 0 > unsound 333 68 36 8 5 4 1 0 0 0 0 1 1 1 1 > > > table(decision,post.damage) > post.damage > decision 0 1 2 3 4 5 6 7 10 12 13 > fit 119 4 1 1 0 0 0 0 1 0 0 > nusm 212 16 11 2 0 2 1 1 0 1 0 > unfit 31 1 0 0 0 0 0 0 0 0 0 > unsound 441 8 5 3 1 0 0 0 0 0 1Could you please post commands to define the df 'offend'? _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102 Gilmer Hall McCormick Road Charlottesville, VA 22903 Office: B011 +1-434-982-4729 Lab: B019 +1-434-982-4751 Fax: +1-434-982-4766 WWW: people.virginia.edu/~mk9y