[R] converting a matrix into a fn

David Winsemius dwinsemius at comcast.net
Tue Aug 25 18:05:48 CEST 2009


On Aug 25, 2009, at 8:45 AM, maram salem wrote:

> Dear All,
> I have a matrix m of the form
>  m
>             [,1]             [,2]
>   [1,]  9072.302 0.00000004462366
>   [2,]  9086.811 0.00000005628169
>   [3,]  9101.320 0.00000007126347
>   [4,]  9115.830 0.00000008986976
>   [5,]  9130.339 0.00000011260000
>   [6,]  9144.848 0.00000014018405
>   [7,]  9159.357 0.00000017344229
>   [8,]  9173.866 0.00000021363563
>   [9,]  9188.375 0.00000026389996
>  [10,]  9202.884 0.00000032406678
>
> where the first col is my variable x and the second is f(x). I've  
> obtained this from the result of a kernel density estimate so I  
> don't know the explict form of f(x) .
> For some reason i want to integerate f(x) over a certain range using  
> integrate( ). So i want R to consider the above matrix as a function  
> where the first col is the argument x and the second is the  
> realization f(x).
> I've tried as.function and vectorize but it didn't work out.
> Could u help me do it?
> Thanks
> Maram
>

http://finzi.psych.upenn.edu/Rhelp08/2008-July/169121.html


>
>
>
> 	[[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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list