Re: [R] sample matrix

From: Ferdinand Alimadhi <falimadhi_at_iq.harvard.edu>
Date: Wed 14 Dec 2005 - 03:16:12 EST

Hi Mauricio,
Although you question is not clear, I'm supposing that you want to save as a new object (matrix) whatever is printed out from "cat(x,m,"\n")". If this is the case, then your result is a matrix with 5 rows and 4 columns. For each row, the first 3 values are "x" and the last value is "m". Maybe this will help you.

>pulse <- c(67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 71,
>71, 72, 72, 73, 74)
>m <- NULL
>x <- 0
>
>
result<- matrix(0, 5,4)

>for (i in 1:5)
>{
>x <- sample(pulse,3)
>
>
result[i,1:3]<-x

>m <- mean(x)
>
>
result[i,4]<-m

>cat(x,m,"\n")
>}
>
>
>
Hopefully the object that you wanted is "result"

HTH
>Thanks,
>Mauricio
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>

-- 
Ferdinand Alimadhi
Programmer / Analyst
Harvard University
The Institute for Quantitative Social Science
(617) 496-0187
falimadhi@latte.harvard.edu
www.iq.harvard.edu

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Dec 14 04:19:56 2005

This archive was generated by hypermail 2.1.8 : Wed 14 Dec 2005 - 09:32:41 EST