Understanding R's Lowessfunction

Asked 2 years ago, Updated 2 years ago, 35 views

I am using lowess in the R language (version 3.3.1).

I would like to make some changes to the lowess function, so I would like to make my own work.

Specifically, if you type lowess on the R command line, you will see the following code:

 function(x,y=NULL,f=2/3,iter=3L, delta=0.01*diff(range(x))))) 
{
    xy<-xy.cords(x,y)
    o<-order(xy$x)
    x<-as.double(xy$x[o])
    list(x=x,y=.Call(C_lowess,x,as.double(xy$y[o]),f, 
        iter, delta))
}
<bytecode:0x000000000caf1858>
<environment:namespace:stats>

I would like to do lowess without ordering about x here.
To make sure this function works first,
I copied the function itself of this lowess and created and executed a new function as my lowess.As a result,

Error: object 'C_lowess' not found

The error message appears.

In my understanding, I thought it would be possible to modify each function of R and reuse it as a new function.Until now, I have been able to create functions for the spider.However, I got this kind of error this time, and I looked it up on Google, but the hint didn't get a hit, so I'm asking you a question here.

If you know how to resolve these errors, please let me know.
Thank you for your cooperation.

r

2022-09-30 17:04

1 Answers

If you change the corresponding part of mylowess to stats::C_lowess, it will work.
C_lowess Explicitly retrieves the function from {stats}.


2022-09-30 17:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.