Need help on changing a table
That's no table that's a data.frame :). For what you want probably the easiest way is aggregate. Type ?aggregate for the help information Based on your example and assuming the data is called "mydata" this shold do what you want. aggregate(mydata[,2:3], by=list(item=mydata$Item), sum)
--- gsmkb86 <gsmkb_86 at hotmail.com> wrote:
Hi all: Im kind of new on R and I need help changing a table. The thing is, i read a file on R using the read.table command and the table looks like this: Item 3d Plot XY plot 001 1 0 001 0 1 001 0 1 002 1 0 002 1 0 002 0 1 ... .. .. And what I want to do is generate a new table by item with the sum of the numbres, the next one is an example: Item 3d Plot XY plot 001 1 2 002 2 1 003 ... ... Does anyone know how to do this? Thanks in advance, help is greatly appreciated