I built my own package in R and it works very well. When I hit build and load in Rstudio, there are no errors at all. Everything is fine. However, When I run my function that include .c file I got this error:
Error in .C("SimulateRVine", as.integer(N), as.integer(n), as.integer(w1), : "SimulateRVine" not available for .C() for package "Vicop"!!
What is the problem and how can I solve it?
This is my own package so I rebuild it many times but nothing happen. When I try to use useDynLib("Vicop") and then rebuild my package I got an error. I think this is my problem but do not know how to solve it.
After a hard search as a beginner to c language I see the problem.
I face this issue because I did not register my function. That is for each .c function I must register it in a file which is called int.c
That solve my problem.
Related
I'm currently doing some work on a package, and calling devtools::check() is producing the following warning:
❯ checking Rd files ... WARNING
NULL
However, when manually inspecting each of the .Rd files created by devtools::document() and re-reading the documentation, I don't see why this warning is appearing. I know it's only a warning and doesn't impact the functionality of the package, but I can't figure out where this is coming from.
Any help is greatly appreciated.
This rig-related bug has been fixed with version 0.5.2, see r-lib/rcmdcheck#184 on GitHub. #rossdrucker9 I am well aware that you already know about this.. just want to write it down for future generations that end up here first (like I did).
I'm trying to find an Rcpp replacement for the base optimize function. This link
https://github.com/eddelbuettel/rcppnloptexample/blob/master/src/nlopt.cpp
is a potential solution but I can't get past the sourceCpp error
Error in Rcpp::sourceCpp("R/nlopt.cpp") :
Error 1 occurred building shared library.
> library('nloptr')
> Rcpp::sourceCpp("R/nlopt.cpp")
nlopt.cpp:4:10: fatal error: 'nloptrAPI.h' file not found
The header file is in fact on my computer at /Library/Frameworks/R.framework/Versions/4.1/Resources/library/nloptr/include
I can include the whole path to the header and it seems to work fine but that seems a bit kludgy.
What do I need to do to tell R or Rcpp where to look?
This link as some useful discussion about the issue of finding headers.
https://stackoverflow.com/questions/13995266/using-3rd-party-header-files-with-rcpp has useful information.
To find out where your 'missing' header is located, the /Library/Frameworks ... link above is useful, replacing nloptr with the name of the package that has the header you are looking for.
I am trying to use kerasR for deep learning in R. I am trying to reproduce the examples in the package. Trying the following code produces error:
library(kerasR)
mod <- Sequential()
The error is:
Error in Sequential() : attempt to apply non-function
I'd suggest to look at this issue in KerasR Github repo:
https://github.com/statsmaths/kerasR/issues/1
Basically you should check where is located your version of python and then use reticulate::use_python("PATH_TO_PYTHON") to tell the system where to find Python.
Watch Out!
You can load just one Python interpreter per session and the use_python() function doesn't warn you if there already is a loaded interpreter.
Moreover if you run py_config() it automatically loads the first interpreter that he finds (which, in your case, seems to be the wrong one!), thus you'd better call reticulate::use_python("PATH_TO_PYTHON") before anything else.
I am trying to use the R function dmvnorm (found in the mvtnorm package) in Sublime Text 3. I installed it and ran my code in RStudio, so I know the code is fine. In sublime, I entered:
install.packages('mvtnorm',repos='http://cran.us.r-project.org')
library(mvtnorm)
It looked as though it worked, but when I ran my code it said:
Error: could not find function "dmvnorm"
I'm using a Mac and my hunch is this is somehow related to specifying the path in Preferences -> Package Settings -> Sublime REPL -> Settings - User. The current path displayed as part of the error reads:
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Thanks!
I had a hard time with this recently as well. I'm very new to R so I'm not sure this is the best answer, but to hold you off until someone gives a better one, did you include library('package.name') in the file (in sublime)? require('package.name') also works, but this appears not to be best practice for reasons described, e.g., here.
I hope this helps!
I created some functions and try to build a package/library, but run into some problems. I hoped to get some advise here on this support site.
This is how I tried to built my package.
I had some functions in an R file, including roxygen2 comments.
Then in R
library("devtools")
library(roxygen2)
setwd("C:to/my/directory")
create("myPackage")
Then I put my functions file in the R folder and changed the DESCRIPTION file.
setwd("./myPackage")
document()
setwd("..")
install("myPackage")
library(myPackage)
Then, when I want to see how a function works
?function1
I see the documentation in my browser.
But when I want to use my function I get an error.
function1
Error: object 'function1' not found
function1()
Error: could not find function "function1"
Does anyone know what I am doing wrong? I am using R 3.3.1 on Windows 7.
Your help or comments are appreciated, thanks in advance!
Ben