Re: [R] collapse a list of dataframes

2015-02-02 Thread dan wang
How about this, t - lapply(a,function(x){colnames(x)=c(A,B);return(x)}) do.call(rbind,t) On Mon, Feb 2, 2015 at 4:00 PM, Tom Wright t...@maladmin.com wrote: Hi all, I'm trying to avoid loops (no real reason, just as an exercise). Given a list:

Re: [R] Best way to get the prices from these strings?

2014-01-29 Thread dan wang
I am not sure if below ways are better. sub(.*(.*).*,\\1,thePrices) sapply(thePrices, function(x){s=gregexpr(pattern ='\\$',x)[[1]][1];e=gregexpr(pattern ='',x)[[1]][1];return(substr(x,s,e-1))}) On Wed, Jan 29, 2014 at 9:29 AM, Keith S Weintraub kw1...@gmail.com wrote: Folks, I got the

Re: [R] integrate

2013-11-21 Thread dan wang
That works. Thanks a lot! On Wed, Nov 20, 2013 at 11:52 PM, David Winsemius dwinsem...@comcast.netwrote: On Nov 20, 2013, at 8:39 PM, David Winsemius wrote: On Nov 20, 2013, at 7:12 PM, dan wang wrote: Hi all, Can anyone help me with below integrate function? Basically, I

[R] about the integrate

2013-11-21 Thread dan wang
Hi all, I tried below two methods to calculate the integrate of a same function. Two different results are given. The first one should be the right answer. Can any one help to explain why? Another issue is, the first one is not convenient as I have to update the mu and sigma outside the function.

[R] integrate

2013-11-20 Thread dan wang
Hi all, Can anyone help me with below integrate function? Basically, I want to calculate the integral of the sum of two kernel density functions. But the error shows that: In x - a : longer object length is not a multiple of shorter object length y1 = rnorm(10) y2 = rnorm(10) fhat -

[R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread dan wang
Hi all, I am trying to write a new function based on an existing function in stats. This function requires to call a c program C_BinDist. The new function couldn't work without load this c script. How can I find this C_BinDist function and load it to make my new function work through? Thanks,

Re: [R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread dan wang
14:34, dan wang escreveu: Hi all, I am trying to write a new function based on an existing function in stats. This function requires to call a c program C_BinDist. The new function couldn't work without load this c script. How can I find this C_BinDist function and load it to make my new

Re: [R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread dan wang
Thanks, that works!! On Fri, Nov 15, 2013 at 11:16 AM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 15/11/2013 16:11, dan wang wrote: Thanks, I think you are right.. How can I access this object? fortunes::fortune(14) applies. Thanks, Dan On Fri, Nov 15, 2013 at 11:04 AM

Re: [R] integrate function

2013-02-12 Thread dan wang
Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of dan wang Sent: Tuesday, February 12, 2013 7:41 AM To: r-help@r-project.org Subject: [R] integrate function Hi All, Can