Re: [R] aggregate and the $ operator

2016-01-22 Thread William Dunlap via R-help
Using column names where you used column numbers would work: example <- data.frame( check.names = FALSE, Nuclei = c(133L, 96L, 62L, 60L), `Positive Nuclei` = c(96L, 70L, 52L, 50L), Slide = factor(c("A1", "A1", "A2", "A2"), levels = c("A1", "A2"))) aggregate(example["Nuclei"], by=ex

Re: [R] aggregate and the $ operator

2016-01-22 Thread Ed Siefker
So that's how that works! Thanks. On Fri, Jan 22, 2016 at 1:32 PM, Joe Ceradini wrote: > Does this do what you want? > > aggregate(Nuclei ~ Slide, example, sum) > > On Fri, Jan 22, 2016 at 12:20 PM, Ed Siefker wrote: >> >> Aggregate does the right thing with column names when passing it >> nume

Re: [R] aggregate and the $ operator

2016-01-22 Thread Joe Ceradini
Does this do what you want? aggregate(Nuclei ~ Slide, example, sum) On Fri, Jan 22, 2016 at 12:20 PM, Ed Siefker wrote: > Aggregate does the right thing with column names when passing it > numerical coordinates. > Given a dataframe like this: > > Nuclei Positive Nuclei Slide > 1133

Re: [R] aggregate and the $ operator

2016-01-22 Thread David Wolfskill
On Fri, Jan 22, 2016 at 01:20:59PM -0600, Ed Siefker wrote: > Aggregate does the right thing with column names when passing it > numerical coordinates. > Given a dataframe like this: > > Nuclei Positive Nuclei Slide > 1133 96A1 > 2 96 70A1 > 3 62

[R] aggregate and the $ operator

2016-01-22 Thread Ed Siefker
Aggregate does the right thing with column names when passing it numerical coordinates. Given a dataframe like this: Nuclei Positive Nuclei Slide 1133 96A1 2 96 70A1 3 62 52A2 4 60 50A2 I can call 'aggregate' li