s-news
[Top] [All Lists]

Re: [S] sampling from a vector subset

To: Valerie Zartarian <VZARTARIAN@usgs.gov>
Subject: Re: [S] sampling from a vector subset
From: John Wallace <jrw@fish.washington.edu>
Date: Tue, 20 Apr 1999 17:19:51 -0700 (PDT)
Cc: s-news@wubios.wustl.edu
In-reply-to: <s71cbfbb.028@IGSRN008.er.usgs.gov>
Sender: owner-s-news@wubios.wustl.edu


temp_c("R","N","N","R","M","M","R","R","M","R","R","N","R","R","N")
temp.r_seq(along=temp)[temp=="R"]
temp.z_temp
temp.z[sample(temp.r, 3)]_"Z"
temp.z
temp    # To compare

On Tue, 20 Apr 1999, Valerie Zartarian wrote:

> 
> I have a vector of the following form:
> 
> temp_c("R","N","N","R","M","M","R","R","M","R","R","N","R","R","N")
> 
> I want to replace a random sample of 3 of the "R"s with a "Z".  I would
greatly appreciate any insight into how to do this.  
> 
> Thank you very much.
> 
> Valerie Zartarian
> 
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message:  unsubscribe s-news
> 

-- 
John Wallace
University of Washington                    ^    ^    ^
Fisheries Research Institute               / \  / \  / \   ^
Box 357980                                 / \  / \   |   / \
Seattle, WA 98195-7980                      |    |  o__~  / \
PHONE   (206) 860-3322                  @ @         /\/\   |
FAX     (206) 685-7471                   ~    
E-MAIL        jw@u.washington.edu              o
WWW      http://www.fish.washington.edu/people/jrw/Wallace.html 
                                                o  _///_ //
                                                <`)=  _<<
                                                    \\\  \\

"For we are all prisoners of our times and days, yet all may
seek the freedom of heart that cannot be taken from us by any
power."
                     In:  _To See Heaven in a Wild Flower_
                               by Ann Tonsor Zeddies 

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>