# [R] Simulating data

Frede Aakmann Tøgersen frtog at vestas.com
Fri Apr 4 12:08:35 CEST 2014

```Hi Teresa

Try this:

Median <- 4.3
Mean <- 4.2
SD <- 1.8
RangeLower <- 0
RangeUpper <- 8

par(mfcol = c(1,2))

(bpstats <- boxplot(rnorm(100, mean = Mean, sd = SD), outl = FALSE))

## assuming normality of original data since we don't know the distribution
## get the 25% and 75% quantile
q25 <- qnorm(0.25, mean = Mean, sd = SD)
q75 <- qnorm(0.75, mean = Mean, sd = SD)

yourstats <- matrix(c(RangeLower, q25, Median, q75, RangeUpper), ncol = 1)

bpstats\$stats <- yourstats

bxp(bpstats, outl = FALSE)

Yours sincerely / Med venlig hilsen

Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Mª Teresa Martinez Soriano
> Sent: 4. april 2014 10:49
> To: r-help at r-project.org
> Subject: [R] Simulating data
>
> Hi to everyone
>
>
> To simulate data I only know this command:
>
> rnorm(n , mean, sd)
>
> It exists another way to specify Median and range as well?
>
> The point is that I have  this information about the variable:
>
>
> Median: 4.3
> Mean: 4.2
> SD: 1.8
> Range: 0-8
>
> and I need a boxplot, but I don't have the original data, simulating data
> looks a good idea to solve it.
>