[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 ..$ :

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
actor of around sqrt(2),right?), even if > both are for the mean or both are for the median. > > Cheers, > Bert > > On Fri, Jul 5, 2013 at 11:28 AM, David Winsemius > wrote: >> >> On Jul 5, 2013, at 11:15 AM, Shaun Jackman wrote: >> >>> Hi Bert, Dennis, >

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
lower = conf[1,], upper = conf[2,])) Cheers, Shaun On 5 July 2013 11:28, David Winsemius 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

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
rrent/ for an expanded > version of the package help pages, 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, 201

[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] Comparing each level of a factor to the global mean

2013-06-27 Thread Shaun Jackman
June 2013 05:50, Adams, Jean wrote: > Shaun, > > See the help on contrasts ... > ?contr.treatment > > Jean > > > On Tue, Jun 25, 2013 at 7:07 PM, Shaun Jackman wrote: >> >> Hi, >> >> I've used `lm` to create a linear model of a continuou

[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 comparisons