[R] Integration + Normal Distribution + Directory Browsing Processing Questions

Dimitris Rizopoulos Dimitris.Rizopoulos at med.kuleuven.be
Sun Jan 21 21:37:51 CET 2007


you can use the `...' argument of integrate, e.g.,

integrate(dnorm, 0, 1)
integrate(dnorm, 0, 1, mean = 0.1)
integrate(dnorm, 0, 1, mean = 0.1, sd = 1.2)

look at ?integrate for more info.

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
      http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting Nils Hoeller <mail at nhoeller.de>:

> Hi everyone,
>
> I am new to R, but it's really great and helped me a lot!
>
> But now I have 2 questions. It would be great, if someone can help me:
>
> 1. I want to integrate a normal distribution, given a median and sd.
> The integrate function works great BUT the first argument has to be a
> function
>
> so I do integrate(dnorm,0,1) and it works with standard m. and sd.
>
> But I have the m and sd given.
>
> So for fixed m and sd I work around with a new function mynorm
>
> mynorm <- function(n) {
>     ret <- dnorm(n,0.6,0.15)
>     ret
> }
>
> for example.
>
> BUT what can I do for dynamic m and sd?
> I want something like integrate(dnorm(,0.6,0.15),0,1), with the first
> dnorm parameter open for the
> integration but fixed m and sd.
>
> I hope you can help me.
>
> 2. I am working with textfiles with rows of measure data.
> read.table("file") works fine.
>
> Now I want R to read.table all files within a given directory and
> process them one by the other.
>
> for(all files in dir xy) {
> x <- read.table(nextfile)
> process x
> }
>
> Is that possible with R? I hope so. Can anyone give me a link to examples.
>
> Thanks for your help
>
> Nils
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>
>



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list