[R] Simulating web requests

Rui Barradas ruipbarradas at sapo.pt
Thu Jun 28 17:17:13 CEST 2012


Hello,

Sorry if I've misread your original post.
See answer inline

Em 28-06-2012 05:15, Mohan Radhakrishnan escreveu:
>
> Not being the expert I have looked at papers like 'simpleR { Using R for
> Introductory Statistics' by John Verzani. Some sample Code is in these
> papers. Looks like I have to search for ideas to code a programming
> language like Java by taking input from R(r-java). Can R be used
> directly to hit web url's based on distributions that these functions
> generates ?
>
> ?rnorm
> ?runif
> ?rgamma
> ?rexp

R can be used to access the web using url's as connections. The base and 
utils functions scan(), read.table(), readLines(), etc, can use a url.
Here's an example with readLines(). It reads r-project's home page.


url <- "http://www.r-project.org/"
u <- file(url, open="rt")
x <- readLines(u)
close(u)
length(x)
[1] 26
x


>
> I also realize the work 'Simulation' means simulation of queues or other
> simulation experiments. Law's book on simulation ?
>
> This is about generation of traffic.
>

I don't know that book in particular but if the times between events 
follow an exponential distribution with rate parameter lambda then the 
number N(t) of events that occur in a time interval of units of time 
follows a Poisson with parameter lambda*t. Since you've said 
"self-similar" I assume that the exponentials are (independent and) 
identically distributed, i.e., a Homogeneous Poisson Process. This is 
very easy to simulate, and a standard textbook exercise. Google it and 
you'll find usefull links in the first page. (To generate the times of 
events use rexp.)

Rui Barradas

> Mohan
>
> -----Original Message-----
> From: David Winsemius [mailto:dwinsemius at comcast.net]
> Sent: Wednesday, June 27, 2012 8:13 PM
> To: Mohan Radhakrishnan
> Cc: r-help at r-project.org
> Subject: Re: [R] Simulating web requests
>
>
> On Jun 27, 2012, at 6:58 AM, Mohan Radhakrishnan wrote:
>
>> Homework ? You mean the question is at a high level.
>>
>> I use R. It is just the simulation part that I am investigating.
>> Several
>> papers on Capacity Planning that I am working on are useful for
>> analyzing log traffic using R for GOF tests etc. But I am not able to
>> find many papers on using R or r-java to generate traffic that
>> simulates
>> distributions. SciPY could be useful here but it looks like
>> interfacing
>> R and Java can help.
>>
>> Maybe I am on the wrong track here but the only other option seems
>> to be
>> expensive simulators.
>
> I'm sure Rui would be happy to get a small consulting fee to show you
> how to do it in one line of R code.
>



More information about the R-help mailing list