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

From: Nils Hoeller <mail_at_nhoeller.de>
Date: Sun 21 Jan 2007 - 19:27:35 GMT

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)

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


R-help@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. Received on Mon Jan 22 06:32:26 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 22 Jan 2007 - 20:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.