Message-ID: <f1b56b55-034a-46e5-8f30-a5dfa5dd38c8@email.android.com>
Date: 2011-01-11T07:25:25Z
From: Jeff Newmiller
Subject: Generation of Normal Random Numbers
In-Reply-To: <783805.62583.qm@web94503.mail.in2.yahoo.com>
So you need to cbind the four vectors together... ?cbind
"saggak" <saggak1908 at yahoo.co.in> wrote:
>Dear R helpers
>
>I have a data frame as given below
>
>df = data.frame(A = c(776,827,836,995,855,1026,1203,1363,965,1195),
>?????????????????????? B =
>c(806,953,1049,1056,1243,764,1148,1162,948,1154),
>?????????????????????? C =
>c(959,1155,1193,1163,863,1070,1087,877,1132,944),
>?????????????????????? D =
>c(906,760,978,1170,1009,883,1007,960,828,113))
>
># Actually the real data has number of vectors and not only A, B, C and
>D.
>
>m = as.numeric(lapply(df, mean))
>s = as.numeric(lapply(df, sd))
>
>gives
>
>> m
>[1] 1004.1 1028.3 1044.3? 861.4
>> s
>[1] 194.5899 158.7052 123.3000 285.8695
>
>I need to generate 25 (normal) random numbers for each of these mean
>and corresponding standard deviation combination (m[i], s[i]). i.e. I
>need to have a table (dim 25 X? 4) giving me random numbers.
>
>
>rnorm(25, m[1], s[1])?? rnorm(25, m[2], s[2])?? rnorm(25, m[3], s[3])?
>rnorm(25, m[4], s[4])
>?? ....................?????????? .........................??????????
>............... ? ? ? ? ? ? ? ? .................
>?? ....................?????????? .........................??????????
>............... ? ? ? ? ? ? ? ? .................
>?? ....................?????????? .........................??????????
>............... ? ? ? ? ? ? ? ? .................
>?? ....................?????????? .........................??????????
>............... ? ? ? ? ? ? ? ? .................
>
>
>?? ....................?????????? .........................??????????
>............... ? ? ? ? ? ? ? ? .................?????
>
>
>Kindly guide
>
>
>Thanking in advance
>
>Sagga K
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.