[R] Dennis Chabot poss. answer

Erin Hodgess hodgess at gator.dt.uh.edu
Wed Sep 20 22:07:15 CEST 2006


Hi Dennis!

Here is a possible solution to consider:


> a <- data.frame(x=1:25,y=rnorm(25))
> a
    x           y
1   1  1.38958705
2   2 -0.45165628
3   3  0.86517671
4   4  0.40802481
5   5 -2.00104605
6   6  0.11152748
7   7  1.84400316
8   8  0.80775204
9   9 -0.12510867
10 10 -0.13650037
11 11 -0.63498148
12 12  1.70665004
13 13 -0.42427846
14 14  0.38587832
15 15 -0.07601500
16 16  0.40442795
17 17  1.78181958
18 18 -0.07199413
19 19 -0.62582419
20 20  0.71653130
21 21 -1.07557102
22 22 -0.04874676
23 23 -0.09447060
24 24 -0.99221486
25 25  0.16559026
> # Set row numbers....
> b <- c(2,5,7,18,22)
> a[b,2] <- rnorm(length(b))
> a
    x          y
1   1  1.3895870
2   2 -0.4613160
3   3  0.8651767
4   4  0.4080248
5   5 -0.5564420
6   6  0.1115275
7   7  1.6625939
8   8  0.8077520
9   9 -0.1251087
10 10 -0.1365004
11 11 -0.6349815
12 12  1.7066500
13 13 -0.4242785
14 14  0.3858783
15 15 -0.0760150
16 16  0.4044279
17 17  1.7818196
18 18  2.0357456
19 19 -0.6258242
20 20  0.7165313
21 21 -1.0755710
22 22 -1.2000225
23 23 -0.0944706
24 24 -0.9922149
25 25  0.1655903
 

Hope this can be useful!

Note:  I accidentally deleted the original e-mail.

Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: hodgess at gator.uhd.edu



More information about the R-help mailing list