Cannot install Hmisc using renv: Installing Formula [1.2-4] ... FAILED - r

when trying to install Hmisc in R using renv I get the message underneath. Could somebody help me please?
I'm using:
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics", with
RStudio 2022.02.3 Build 492, using a
Platform: x86_64-apple-darwin17.0 (64-bit), and
renv 0.14.0
--
Installing 'Hmisc' ...
[1/6] Installing Formula...
Retrieving 'https://cran.rstudio.com/bin/macosx/contrib/4.2/Formula_1.2-4.tgz' ...
OK [file is up to date]
Installing Formula [1.2-4] ...
FAILED
Error in if (eval(cond, envir = environment(dot))) return(eval(expr, envir = environment(dot))) : the condition has length > 1
Calls: sourceWithProgress ... renv_scope_install -> renv_scope_install_macos -> case
In addition: Warning message:
In system2(R(), args, stdout = TRUE, stderr = TRUE) : running command ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CC 2>&1' had status 1
Traceback (most recent calls last):
15: sourceWithProgress(script = "/var/folders/y9/8c6qs4hj6pq1nnv725g7gbxw0000gn/T/9878-ce12-709e-35eb",
encoding = "UTF-8", con = stdout(), importRdata = NULL, exportRdata = NULL)
14: eval(statements[[idx]], envir = sourceEnv)
13: eval(statements[[idx]], envir = sourceEnv)
12: renv::install("Formula")
11: renv_install_impl(records)
10: renv_install_staged(records)
9: renv_install_default(records)
8: handler(package, renv_install_package(record))
7: renv_install_package(record)
6: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
vwritef("\tFAILED")
writef(e$output)
})
5: renv_install_package_impl(record)
4: r_cmd_install(package, path)
3: renv_scope_install()
2: renv_scope_install_macos(.envir)
1: case(matches("/usr/bin/clang") ~ TRUE, matches("clang") ~ Sys.which("clang") ==
"/usr/bin/clang", FALSE)
Execution halted

This part of the stack trace:
< ... >
3: renv_scope_install()
2: renv_scope_install_macos(.envir)
1: case(matches("/usr/bin/clang") ~ TRUE, matches("clang") ~ Sys.which("clang") ==
"/usr/bin/clang", FALSE)
suggests that something went wrong when renv was trying to query information about the system compiler.
Somewhat surprisingly, whenever one upgrades to a new version of macOS, any existing command line tools (CLT) installation will be removed, and needs to be manually re-installed. renv relies on these command line tools being available when querying information about the system's installation capabilities, so re-installing command line tools with:
xcode-select --install
should alleviate the issue.
I've also made some changes in the development version of renv to ensure that this situation is handled and reported better.

Related

Installing addmtoolbox on Windows : x is not a data.table (RStudio)

I'm trying to install addmtoolbox on Rstudio. every things is fine but at last i got this error:
Error: Vignette re-building failed.
Execution halted
Error: Failed to install 'addmtoolbox' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> Quitting from lines 80-84 (addmtoolbox_modelfit_walkthrough.Rmd)
E> Error: processing vignette 'addmtoolbox_modelfit_walkthrough.Rmd' failed with diagnostics:
E> x is not a data.table
E> --- failed re-building 'addmtoolbox_modelfit_walkthrough.Rmd'
E>
E> SUMMARY: processing the following file failed:
E> 'addmtoolbox_modelfit_walkthrough.Rmd'
E>
E> Error: Vignette re-building failed.
E> Execution halted
also i'm trying to install package from zip file. installation is successful but when i run addm_preprocess function,
i got same error:
> my.dat = addm_preprocess(choice.dat = addm_data_choice,
+ eye.dat = addm_data_eye,
+ timestep = 10,
+ rtbinsize = 100)
Error in setkeyv(x, cols, verbose = verbose, physical = physical) :
x is not a data.table
would you please help me?
thanks.
addmtoolbox:
https://rdrr.io/github/AlexanderFengler/addmtoolbox/
EDIT:
i found error code:
eye$fixdur = timestep * round(eye$fixdur/timestep)
rts = eye %>% group_by(id) %>% summarize(rt = sum(fixdur))
setkey(rts,id)
choice = choice %>% select(-rt)
choice = choice[rts]
setkey(rts,id) return error:
> rts
# A tibble: 1 x 2
id rt
* <dbl> <dbl>
1 0 0
> setkey(rts,id)
Error in setkeyv(x, cols, verbose = verbose, physical = physical) :
x is not a data.table
solution by : hdkrgr
It looks like you're providing a tibble when a data.table is expected.
You should be able to convert the object with as.data.table.
Alternatively you could also use dtyplyr for unified tibble/data.table
objects. github.com/tidyverse/dtplyr

R Installation of Package 'Rcpp' had Non-Zero Exit Status

I am trying to run a package called Harmony on R in Jupyter Notebooks using the following lines of code:
library(devtools)
install_github("immunogenomics/harmony")
However, I get an error message reading:
Installing 45 packages: Rcpp, dplyr, tidyr, ggplot2, Matrix, tibble, rlang, SingleCellExperiment, RcppArmadillo, RcppProgress, cli, fansi, lifecycle, pillar, vctrs, glue, digest, isoband, scales, testthat, farver, R6, lattice, rstudioapi, callr, prettyunits, backports, processx, ps, tidyselect, BH, GenomicRanges, Biobase, DelayedArray, BiocGenerics, S4Vectors, IRanges, GenomeInfoDb, matrixStats, BiocParallel, RCurl, XVector, zlibbioc, stringi, SummarizedExperiment
Error: Failed to install 'harmony' from GitHub:
(converted from warning) installation of package 'Rcpp' had non-zero exit status
Traceback:
1. install_github("immunogenomics/harmony")
2. pkgbuild::with_build_tools({
. ellipsis::check_dots_used(action = getOption("devtools.ellipsis_action",
. rlang::warn))
. {
. remotes <- lapply(repo, github_remote, ref = ref, subdir = subdir,
. auth_token = auth_token, host = host)
. install_remotes(remotes, auth_token = auth_token, host = host,
. dependencies = dependencies, upgrade = upgrade, force = force,
. quiet = quiet, build = build, build_opts = build_opts,
. build_manual = build_manual, build_vignettes = build_vignettes,
. repos = repos, type = type, ...)
. }
. }, required = FALSE)
3. install_remotes(remotes, auth_token = auth_token, host = host,
. dependencies = dependencies, upgrade = upgrade, force = force,
. quiet = quiet, build = build, build_opts = build_opts, build_manual = build_manual,
. build_vignettes = build_vignettes, repos = repos, type = type,
. ...)
4. tryCatch(res[[i]] <- install_remote(remotes[[i]], ...), error = function(e) {
. stop(remote_install_error(remotes[[i]], e))
. })
5. tryCatchList(expr, classes, parentenv, handlers)
6. tryCatchOne(expr, names, parentenv, handlers[[1L]])
7. value[[3L]](cond)
I am wondering why the installation of package Rcpp has a non-zero exit status and how I can resolve this to install my original package.

RStan toolchain error on ubuntu

I installed RStan, had a problem, uninstalled it, and then tried reinstalling it using https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Mac-or-Linux
However, when I try using rstan, I get this error:
Error in library(rstan) : there is no package called ‘rstan’
I noticed when I run the toolchain diagnostic mentioned on the above page,
fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '
return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
' )
fx( 2L, 5 ) # should be 10
I get an error:
clang: warning: argument unused during compilation: '-arch x86_64'
clang: warning: argument unused during compilation: '-arch x86_64'
file16777e2261ec.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [file16777e2261ec.so] Error 1
ERROR(s) during compilation: source code errors or compiler configuration errors!
Program source:
1:
2: // includes from the plugin
3: #include <R.h>
4: #include <Rdefines.h>
5: #include <R_ext/Error.h>
6:
7:
8: // user includes
9:
10:
11: // declarations
12: extern "C" {
13: SEXP file16777e2261ec( SEXP x, SEXP y) ;
14: }
15:
16: // definition
17:
18: SEXP file16777e2261ec( SEXP x, SEXP y ){
19:
20: return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
21:
22: Rf_warning("your C++ program does not return anything");
23: return R_NilValue ;
24: }
25:
26:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! clang: warning: argument unused during compilation: '-arch x86_64'
clang: warning: argument unused during compilation: '-arch x86_64'
file16777e2261ec.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [file16777e2261ec.so] Error 1
In addition: Warning message:
running command '/usr/lib/R/bin/R CMD SHLIB file16777e2261ec.cpp 2> file16777e2261ec.cpp.err.txt' had status 1
Error in fx(2L, 5) : could not find function "fx"
What is going wrong? Thank you!

Why R CMD Check failed with weird error in winbuilder ? "type must be LANGSXP at this point"

I am trying to propose an update of my package 'antaresRead' on CRAN.
When I use the service "https://win-builder.r-project.org/upload.aspx" for R-devel to test my package, I have this error :
test_check("antaresRead")
Error in length(ans$indices) : type must be LANGSXP at this point
Calls: test_check ... eval -> eval -> suppressMessages -> withCallingHandlers
Logs are here
Why I have this error for this platform and with R-devel ? Can I correct It ?
When I use the same service with R-release and R-oldRelease, checks are OK :
Rrelease
RoldRelease
With the same code :
Travis Is
OK
appVeyor is OK for 8 combinations
rhub is also OK for 8 platforms
rhub::check(platform = 'debian-gcc-release')
rhub::check(platform = 'macos-elcapitan-release')
check_for_cran(platforms = "windows-x86_64-oldrel")
check_for_cran(platforms = "windows-x86_64-patched")
rhub::check(platform = 'fedora-clang-devel')
rhub::check(platform = 'fedora-gcc-devel')
rhub::check(platform = 'debian-gcc-patched')
rhub::check(platform = 'debian-gcc-devel')
Has anyone ever encountered this error? how to solve it?
What I did :
Download the R-devel version for Windows found here --> R 3.5.0
Build and check my pacakge antaresRead for x64 --> build and check are OK
Build and check my package for i386 --> build OK but faild in Check with the same error
Error in length(ans$indices) : type must be LANGSXP at this point
Calls: test_check ... eval -> eval -> suppressMessages -> withCallingHandlers
Solution :
- My bad, it's my code, it's my fault.
The error come from this code
districtLinks <- merge(districtLinks, districts[, .(district, x, y)],
by.x = "toDistrict", by.y = "district")
districtLinks is empty sometimes and with the new version of R and data.table this provokes an error only in Windows 32bits. I added a check before.
This error come because I wanted to merge an empty data.table with another data.table.
districtLinks <- merge(districtLinks, districts[, .(district, x, y)],
by.x = "toDistrict", by.y = "district")
What I did is to add a check before the merge
if(!dim(districtLinks)[1]==0){
districtLinks <- merge(districtLinks, districts[, .(district, x, y)],
by.x = "toDistrict", by.y = "district")
}

KnitR unable to download documents

I am able to run this code normally in R.
setInternet2(use = TRUE)
download.file("http://d396qusza40orc.cloudfront.net/dsscapstone/dataset/Coursera-SwiftKey.zip", "Coursera-SwiftKey.zip", method = "curl", mode = 'wb')
unzip("Coursera-SwiftKey.zip", files=c("final/en_US/en_US.twitter.txt", "final/en_US/en_US.news.txt", "final/en_US/en_US.blogs.txt"), exdir=".")
But when i try to use knitR it gives me this error
Quitting from lines 15-21 (milestone.Rmd)
Error in parse(text = x, srcfile = src) : <text>:5:106: unexpected ')'
4: unzip("Coursera-SwiftKey.zip", files=c("final/en_US/en_US.twitter.txt", "final/en_US/en_US.news.txt", "final/en_US/en_US.blogs.txt"), exdir=".")
5: file.copy(c("final/en_US/en_US.twitter.txt", "final/en_US/en_US.news.txt", "final/en_US/en_US.blogs.txt"?)
^
Calls: <Anonymous> ... <Anonymous> -> parse_all -> parse_all.character -> parse
Execution halted
I am using R Studio and MAC OS X.
I tried removing the s from https but it still di not work.

Resources