Hello everyone,

I have a dataset in the following format:

col1  col2
#     #
#     #
#     #
#     #
#     #
#     #


What I want to do is:
loop a random sample 10 times, and for each time it is sampled I want to
run a correlation between both columns.  What I have so far is this:

>feb <- read.csv("corr.csv")  # where the dataset is for February
>attach(feb)
>for(i in 1:10){
>    feb[sample(nrow(feb),###),]  # "###" represents the number of rows
>    print(cor(col1,col2),)
>}


all this is doing for me is doing 10 correlations between all 10 samples
at the same time.  What I was thinking was to do something like:
- append a sample of the data: sample1 <- sample()
- do the correlation cor()
- remove that sample using rm(sample1) function
- repeat 9 more times


any help is greatly appreciated

Cheers,
Grant Humphries


University of Alaska Fairbanks
-EWHALE-lab Irving I  Rm 419
902 Koyukuk Dr.
Fairbanks, Alaska
99775
907-474-7959
[EMAIL PROTECTED]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to