Im trying to run the following rmarkdown code:
https://docs.google.com/document/d/164VZx3_cZ4tBa1Um39VH1cQ4zqRuCvpCTj-B50Vq2gk/edit?usp=sharing
But Im getting the following error when I knit the code:
Quitting from lines 26-47 (demo.Rmd)
Error in (function (file = "", code = NULL, env = globalenv(), embeddedR = TRUE, :
Error 1 occurred building shared library.
Calls: <Anonymous> ... block_exec -> in_dir -> engine -> do.call -> <Anonymous>
In addition: Warning message:
No function return type found for Rcpp::export attribute at file1af863722d6.cpp:4
Execution halted `
When I replace {Rcpp} with {rcpp} I get to run it but its not giving the output. How do I get it to run and give the output?
Related
I'm trying to knit an RStudio notebook but i'm getting the following error:
"Error in UseMethod("mutate_") : no applicable method for 'mutate_' applied to an object of class "function" Calls: ... mutate -> log_mutate -> .fun -> mutate.default -> mutate_"
with the following lines:
data <- data %>%
mutate(
variable = factor(variable,ordered = FALSE)
)
The funniest thing is that the R code works just fine and does the expected. Only the knitting doesn't work.
Any thoughts? Thanks in advance!
Based on this Q&A , this code defines a package containing an active binding to the value 1. It passes devtools::check():
my_function <- function() 1
#' return 1
#' #usage my_active_binding
#' #name my_active_binding
NULL
.onLoad <- function(libname, pkgname) {
ns <- asNamespace(pkgname)
makeActiveBinding("my_active_binding", my_function, env = ns)
namespaceExport(ns, "my_active_binding")
}
However if my active binding fails by default (in my use case it should be used in a specific context),
then devtools::check() is not happy anymore.
Edit: actually if I use print() or message() rather than stop() I run into the same issues
my_function <- function() stop("stop!!!")
#' stop!!!
#' #usage my_active_binding
#' #name my_active_binding
NULL
.onLoad <- function(libname, pkgname) {
ns <- asNamespace(pkgname)
makeActiveBinding("my_active_binding", my_function, env = ns)
namespaceExport(ns, "my_active_binding")
}
See below :
-- R CMD check results ---------------------------------- abtest 0.0.0.9000 ----
Duration: 21s
> checking DESCRIPTION meta-information ... WARNING
Non-standard license specification:
GPL3
Standardizable: FALSE
> checking S3 generic/method consistency ... WARNING
Error in (function () : stop!!!
Calls: <Anonymous> -> Filter -> unlist -> lapply -> FUN -> <Anonymous>
Ex�cution arr�t�e
See section 'Generic functions and methods' in the 'Writing R
Extensions' manual.
> checking for code/documentation mismatches ... WARNING
Error in (function () : stop!!!
Calls: <Anonymous> ... Filter -> unlist -> lapply -> FUN -> get -> <Anonymous>
Ex�cution arr�t�e
> checking dependencies in R code ... NOTE
Error in (function () : stop!!!
Ex�cution arr�t�e
> checking foreign function calls ... NOTE
Error in (function () : stop!!!
Calls: <Anonymous> -> lapply -> FUN -> get -> <Anonymous>
Ex�cution arr�t�e
See chapter 'System and foreign language interfaces' in the 'Writing R
Extensions' manual.
> checking R code for possible problems ... NOTE
Error in (function () : stop!!!
Calls: <Anonymous> ... withCallingHandlers -> do.call -> <Anonymous> -> get -> <Anonymous>
Ex�cution arr�t�e
> checking Rd \usage sections ... NOTE
Error in (function () : stop!!!
Calls: <Anonymous> ... Filter -> unlist -> lapply -> FUN -> get -> <Anonymous>
Ex�cution arr�t�e
The \usage entries for S3 methods should use the \method markup and not
their full name.
See chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.
0 errors v | 3 warnings x | 4 notes x
Erreur : R CMD check found WARNINGs
Ex�cution arr�t�e
Exited with status 1.
How can I do to integrate this active binding in my package and satisfy devtools::check() / R CMD check ?
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! Error in .shlib_internal(commandArgs(TRUE)) :
C++14 standard requested but CXX14 is not defined
Calls: <Anonymous> -> .shlib_internal
Execution halted
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command 'C:/PROGRA~1/R/R-36~1.0/bin/x64/R CMD SHLIB file1a1860a0379.cpp 2> file1a1860a0379.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
Some non-English page said that we can overcome by executing the following R script, but it did not work in my case:
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR))
dir.create(dotR)
M <- file.path(dotR, "Makevars")
if (!file.exists(M))
file.create(M)
cat("\nCXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function",
"CXX14 = g++ -std=c++1y",
file = M, sep = "\n", append = TRUE)
The above R script is same as in the following page:
https://github.com/stan-dev/rstan/issues/569
I tried to uninstall and install according to the following page, but the above error occurred.
Rstan installation: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
REF; https://github.com/stan-dev/stan/issues/1613
ref: https://github.com/stan-dev/rstan/issues/633
For me, the issue has been solved by adding manually the following line into the file .R/Makevars.win.
CXX14 = "C:\Rtools\mingw_64\bin\g++.exe"
I am trying to convert a text from French to English using translate function in translateR package. I am using MS translator. Could anybody help me to solve this? I am new to R language and don't have much expertise into this.
This code:
text1 <- "joyeux Noël"
translate(content.vec=text1, microsoft.client.id='xxxxxx',
microsoft.client.secret = 'ZlZ39GooG6w1oiDlUgPcUQXGq7B+jCfchdrL9h0ebz8=',
source.lang = 'fr', target.lang = 'en')
Throws:
Error in fromJSON(postForm("https://datamarket.accesscontrol.windows.net/v2/OAuth2-13", :
error in evaluating the argument 'content' in selecting a method for function 'fromJSON': Error in function (type, msg, asError = TRUE) :
Failed to connect to datamarket.accesscontrol.windows.net port 443: Connection refused
I'm calling roxygenize() with parameter use.Rd2 = TRUE. I have a file testcase.R where I create a simple S3 object using R.oo. Here's the contents of the file. There's nothing for roxygen to do here, and it should ignore the contents:
library( R.oo )
setConstructorS3( "TestCase" ,
function()
{
extend( Object() , "TestCase",
.parameters = list() ,
.validationData = list()
)
} )
And here's the error:
Error in parse.name(partitum) :
(converted from warning) No name found for the following expression in E:/mypackage/R/te
stcase.R line 1:
`library( R.oo ) . . .'
Calls: roxygenize ... <Anonymous> -> maybe.call -> do.call -> <Anonymous> -> par
se.name
How can I eliminate the warning? Per suggestions in other posts, I added the following as the first line, but it didn't work:
#' #nord
Upgrading to Roxygen2 eliminated the error.