[R] how to create a simple loop ?

2009-12-27 Thread Edouard Tallent
I have a 5-row matrix called “data”. There are headers. it look like this : Row 1 Row2Row3Row4Row5 Line1 ………… Line2 ………… Line3 ………… …

[R] how to create a simple loop ?

2009-12-27 Thread Edouard Tallent
Hi everyone. And, Merry Xmas ! I have a 5-row matrix called “data”. There are headers. it look like this : Row 1 Row2Row3Row4Row5 Line1 ………… Line2 ………… Line3 ……

Re: [R] how to create a simple loop ?

2009-12-27 Thread David Winsemius
On Dec 27, 2009, at 9:15 AM, Edouard Tallent wrote: Hi everyone. And, Merry Xmas ! I have a 5-row matrix called “data”. There are headers. it look like this : Row 1 Row2Row3Row4Row5 Line1 ………… Line2 ………

Re: [R] how to create a simple loop ?

2009-12-27 Thread John Kane
...@lycos.com Subject: [R] how to create a simple loop ? To: r-help@r-project.org Received: Sunday, December 27, 2009, 9:15 AM Hi everyone. And, Merry Xmas ! I have a 5-row matrix called “data”. There are headers. it look like this : Row 1   Row2    Row3    Row4    Row5 Line1

Re: [R] how to create a simple loop ?

2009-12-27 Thread jim holtman
try this: mydata - matrix(runif(5000),ncol=5) indices - list(c(173, 193), + c(434, 455), + c(699, 724), + c(955, 977)) result - lapply(indices, function(.indx){ + mean(mydata[.indx[1]:.indx[2], 5]) + }) result [[1]] [1] 0.5364535 [[2]] [1]