Here is another way of doing it using some of the functions in a
step-by-step manner:
> # had to put some separators in since data format was not apparent
> # best to provide sample data with 'dput'
> x <- read.table(textConnection("Cat1|Cat2 |Cat3 | COG |Counts
+ A | B | C |COG1 |10
+
Yes, I guess I should update.
> R.version.string
[1] "R version 2.9.0 (2009-04-17)"
On 24-Oct-10, at 1:12 AM, Gabor Grothendieck wrote:
R.version.string
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
Thanks!
I tried reading the help for aggregate and can't figure out which form
of the formula I am using, and therefore the syntax.
I'm getting the below error.
> aggregate(counts ~ ind, merge(stack(CAT2COG), df, by = 1), sum)
Error in as.data.frame.default(x) :
cannot coerce class "formul
On Sat, Oct 23, 2010 at 7:03 PM, Alison Waller wrote:
> Thanks!
>
> I tried reading the help for aggregate and can't figure out which form of
> the formula I am using, and therefore the syntax.
>
> I'm getting the below error.
>
>> aggregate(counts ~ ind, merge(stack(CAT2COG), df, by = 1), sum)
>
On Sat, Oct 23, 2010 at 6:15 PM, Alison Waller wrote:
> Hi all,
>
> I have some data as follows.
>
> Cat1 Cat2 Cat3 COG Counts
> A B C COG1 10
> B D COG2 20
> C COG3 30
> D COG4 40
>
> I would like to sum all the counts for each category:
Hi all,
I have some data as follows.
Cat1 Cat2 Cat3 COG Counts
ABC COG1 10
BD COG2 20
C COG3 30
D COG4 40
I would like to sum all the counts for each category:
A B C D
10 30 40 60
>CAT2COG<-
lis
6 matches
Mail list logo