Discussion:
[Rcpp-devel] function not getting stored properly..
akshay kulkarni
2018-03-23 11:49:56 UTC
Permalink
dear members,
mygrpc(xmc1,ygix,ygrpc)
Error in .Call(<pointer: (nil)>, x, ygix, ygrpc) :
NULL value passed as symbol address

xmc1 is a matrix of OHLC data of a stock, while ygix and ygrpc are functions that act on the daily increment of the stock.

But when I rewrite the function again using cppFunction in Rcpp, and run it, it is getting executed. Even the function is getting displayed in the output of the ls() function.

I think the function is not getting stored properly, after I finish my session in the R console.

Any idea how to store the function properly so that I can use it again in my R functions without rewriting ygrpc again and again? If ygrpc is not stored properly, why is it getting displayed in the output of the ls() function?

Very many thanks for time and effort...


down votefavoritI have created a function mygrpc using cppFunction using Rcpp. When I call the function after starting the R session, I get the following error:<https://stackoverflow.com/questions/49448920/function-not-getting-stored-properly-in-r-console#>
JJ Allaire
2018-03-23 13:11:38 UTC
Permalink
Rcpp functions compiled with sourceCpp/cppFunction/etc. are not stored
across sessions. If you want this behavior you should write a package.

J.J.
Post by akshay kulkarni
dear members,
I have created a function mygrpc using cppFunction using Rcpp. When I call
mygrpc(xmc1,ygix,ygrpc)
NULL value passed as symbol address
xmc1 is a matrix of OHLC data of a stock, while ygix and ygrpc are
functions that act on the daily increment of the stock.
But when I rewrite the function again using cppFunction in Rcpp, and run
it, it is getting executed. Even the function is getting displayed in the
output of the ls() function.
I think the function is not getting stored properly, after I finish my
session in the R console.
Any idea how to store the function properly so that I can use it again in
my R functions without rewriting ygrpc again and again? If ygrpc is not
stored properly, why is it getting displayed in the output of the ls()
function?
Very many thanks for time and effort...
down votefavoritI have created a function mygrpc using cppFunction using
Rcpp. When I call the function after starting the R session, I get the
<https://stackoverflow.com/questions/49448920/function-not-getting-stored-properly-in-r-console#>
_______________________________________________
Rcpp-devel mailing list
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Dirk Eddelbuettel
2018-03-23 13:35:52 UTC
Permalink
On 23 March 2018 at 09:11, JJ Allaire wrote:
| Rcpp functions compiled with sourceCpp/cppFunction/etc. are not stored
| across sessions. If you want this behavior you should write a package.

As we already said here:

https://stackoverflow.com/questions/49448920/function-not-getting-stored-properly-in-r-console

Akshay: Please do not cross-post.

Dirk

| J.J.
|
| On Fri, Mar 23, 2018 at 7:49 AM, akshay kulkarni <***@hotmail.com>
| wrote:
|
| > dear members,
| >
| >
| > I have created a function mygrpc using cppFunction using Rcpp. When I call
| > the function after starting the R session, I get the following error:
| >
| > > mygrpc(xmc1,ygix,ygrpc)
| > Error in .Call(<pointer: (nil)>, x, ygix, ygrpc) :
| > NULL value passed as symbol address
| >
| > xmc1 is a matrix of OHLC data of a stock, while ygix and ygrpc are
| > functions that act on the daily increment of the stock.
| >
| > But when I rewrite the function again using cppFunction in Rcpp, and run
| > it, it is getting executed. Even the function is getting displayed in the
| > output of the ls() function.
| >
| > I think the function is not getting stored properly, after I finish my
| > session in the R console.
| >
| > Any idea how to store the function properly so that I can use it again in
| > my R functions without rewriting ygrpc again and again? If ygrpc is not
| > stored properly, why is it getting displayed in the output of the ls()
| > function?
| >
| > Very many thanks for time and effort...
| >
| > down votefavoritI have created a function mygrpc using cppFunction using
| > Rcpp. When I call the function after starting the R session, I get the
| > following error:
| > <https://stackoverflow.com/questions/49448920/function-not-getting-stored-properly-in-r-console#>
| >
| >
| > _______________________________________________
| > Rcpp-devel mailing list
| > Rcpp-***@lists.r-forge.r-project.org
| > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
| >
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-***@lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Loading...