[R] Comparing each level of a factor to the global mean

2013-06-25 Thread Shaun Jackman
Hi, I've used `lm` to create a linear model of a continuous variable against a factor variable with four levels using an example R data set (see below). By default, it uses a treatment contrast matrix that compares each level of the factor variable with the first reference level (three

Re: [R] Comparing each level of a factor to the global mean

2013-06-27 Thread Shaun Jackman
June 2013 05:50, Adams, Jean jvad...@usgs.gov wrote: Shaun, See the help on contrasts ... ?contr.treatment Jean On Tue, Jun 25, 2013 at 7:07 PM, Shaun Jackman sjack...@gmail.com wrote: Hi, I've used `lm` to create a linear model of a continuous variable against a factor variable

[R] Lattice barchart with error bars

2013-07-04 Thread Shaun Jackman
Hi, I'd like to draw a lattice barchart of means with error bars to show the standard deviation. I have the barchart, how do I add the error bars? require(datasets) require(lattice) x - aggregate(weight ~ Diet, ChickWeight, function(x) c(mean=mean(x), sd=sd(x))) barchart(weight[,'mean'] ~ Diet,

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
, which include the graphs generated by the code. I believe there's also a base graphics version that you can get from the gplots package, but I don't know a lot about it. Dennis On Thu, Jul 4, 2013 at 2:53 PM, Shaun Jackman sjack...@gmail.com wrote: Hi, I'd like to draw a lattice barchart

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
, Shaun On 5 July 2013 11:28, David Winsemius dwinsem...@comcast.net wrote: On Jul 5, 2013, at 11:15 AM, Shaun Jackman wrote: Hi Bert, Dennis, I'll agree that using a barchart was a poor choice. I was in fact using a notched bwplot to show the median and confidence interval of the median

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
. Cheers, Bert On Fri, Jul 5, 2013 at 11:28 AM, David Winsemius dwinsem...@comcast.net wrote: On Jul 5, 2013, at 11:15 AM, Shaun Jackman wrote: Hi Bert, Dennis, I'll agree that using a barchart was a poor choice. I was in fact using a notched bwplot to show the median and confidence interval

[R] Convert rbind of lists to data.frame

2013-07-31 Thread Shaun Jackman
I'm trying to build a data.frame row-by-row like so: df - data.frame(rbind(list('a',1), list('b', 2), list('c', 3))) I was surprised to see that the columns of the resulting data.frame are stored in lists rather than vectors. str(df) 'data.frame': 3 obs. of 2 variables: $ X1:List of 3 ..$ :