[R] Random number

partha_bagchi@hgsi.com partha_bagchi at hgsi.com
Wed Oct 27 19:14:33 CEST 2004


Let's say x is of size 100.

x <- rnorm(100)
x[sample(1:100,10)] <- NA 






Kunal Shetty <kshe4 at student.monash.edu>
Sent by: r-help-bounces at stat.math.ethz.ch
10/27/2004 12:59 PM

 
        To:     r-help at stat.math.ethz.ch
        cc: 
        Subject:        [R] Random number


Dear R- User

I created  two random number sets using rnorm function and calcuted their 
respective means. However now I would like to randomly
replace some values with NA. Thus create my own test data.
Any help or suggestions on this ?


Also wanted to confirm when multiplying two random number vectors x am y 
by matrix..is this how i do it.
A is the matrix

z <- c(x,y)    # x and y the two set of vectors

w <- A%*%Z   # each element in each vector multipled by the matrix .


regards
Kunal

______________________________________________
R-help at 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




More information about the R-help mailing list