Re: [R] Need help on changing a table

2007-12-01 Thread John Kane
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) ---

Re: [R] Need help on changing a table

2007-12-01 Thread Prof Brian Ripley
Note that read.table() reads a table and returns a _data frame_. So it is the _data frame_ that you want to change (a table is something else in R). This is a simple application of aggregate(), e.g. > aggregate(z[-1], list(Item=z$Item), sum) Item X3d_Plot XY_plot 111 2 2

[R] Need help on changing a table

2007-12-01 Thread gsmkb86
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