Skip to main content
edited body
Source Link
thelatemail
  • 94.3k
  • 12
  • 140
  • 197

Another aggregate variation, avoiding the formula interface, which actually complicates matters in this instance:

aggregate(list(Sum=unlist(dat)), list(Group=cGroup=LETTERS[c(row(dat) + col(dat))-1]), FUN=sum) # Group Sum #1 A 8 #2 B 13 #3 C 13 #4 D 28 #5 E 10 #6 F 18 #7 G 2 

Another aggregate variation, avoiding the formula interface, which actually complicates matters in this instance:

aggregate(list(Sum=unlist(dat)), list(Group=c(row(dat) + col(dat))), FUN=sum) # Group Sum #1 A 8 #2 B 13 #3 C 13 #4 D 28 #5 E 10 #6 F 18 #7 G 2 

Another aggregate variation, avoiding the formula interface, which actually complicates matters in this instance:

aggregate(list(Sum=unlist(dat)), list(Group=LETTERS[c(row(dat) + col(dat))-1]), FUN=sum) # Group Sum #1 A 8 #2 B 13 #3 C 13 #4 D 28 #5 E 10 #6 F 18 #7 G 2 
Post Undeleted by thelatemail
added 10 characters in body
Source Link
thelatemail
  • 94.3k
  • 12
  • 140
  • 197

Another aggregate variation, avoiding the formula interface, which actually complicates matters in this instance:

aggregate(list(Sum=unlist(dat)), list(Group=unlistGroup=c(dat2row(dat) + col(dat))), FUN=sum) # Group Sum #1 A 8 #2 B 13 #3 C 13 #4 D 28 #5 E 10 #6 F 18 #7 G 2 

Another aggregate variation, avoiding the formula interface, which actually complicates matters in this instance:

aggregate(list(Sum=unlist(dat)),list(Group=unlist(dat2)),FUN=sum) # Group Sum #1 A 8 #2 B 13 #3 C 13 #4 D 28 #5 E 10 #6 F 18 #7 G 2 

Another aggregate variation, avoiding the formula interface, which actually complicates matters in this instance:

aggregate(list(Sum=unlist(dat)), list(Group=c(row(dat) + col(dat))), FUN=sum) # Group Sum #1 A 8 #2 B 13 #3 C 13 #4 D 28 #5 E 10 #6 F 18 #7 G 2 
Post Deleted by thelatemail
Source Link
thelatemail
  • 94.3k
  • 12
  • 140
  • 197

Another aggregate variation, avoiding the formula interface, which actually complicates matters in this instance:

aggregate(list(Sum=unlist(dat)),list(Group=unlist(dat2)),FUN=sum) # Group Sum #1 A 8 #2 B 13 #3 C 13 #4 D 28 #5 E 10 #6 F 18 #7 G 2