tcltk in portable R - r

I am using portable R and I want to try the sqldf package a bit, I can load the sqldf package, but running a sql statement and gives me this message:
> sqldf("select * from BOD where Time > 4")
Loading required package: tcltk
Loading Tcl/Tk interface ...Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: NULL
error: Tcl/Tk support files were not installed
Error: require(tcltk) is not TRUE
I have looked for solutions but most of them suggest me to install R, which is not possible as I am using portable R.
What can I do? Thanks.

install R 2.13.1 for Windows, copy ~/R-2.13.1/Tcl folder to ~\R-Portable\App\R-2.11.1
and
~/R-2.13.1/library/tcltk folder to ~/R-Portable/App/Data/library
I tried and it works.

See sqldf FAQ #5

Related

R tcl issue on shared HPC cluster environment

I've been having some issues getting R to run properly on the shared cluster at my institution , where i don't have root access. Some things will work but it gets tricky when i need to install packages etc. The current issue i'm trying to trouble shoot is the following error when trying to load the caret package:
Loading required package: lattice
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/cifs/hariri-long/Scripts/Tools/R/packages/rlang/libs/rlang.so':
/cifs/hariri-long/Scripts/Tools/R/packages/rlang/libs/rlang.so: undefined symbol: R_removeVarFromFrame
Error: package ‘ggplot2’ could not be loaded
Execution halted
I found this page suggesting i install rlang as follows:
> install.packages("rlang",type="source")
Installing package into ‘/cifs/hariri-long/Scripts/Tools/R/packages’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Can't find a usable init.tcl in the following directories:
/usr/share/tcl8.5 ./lib/tcl8.5 ./lib/tcl8.5 ./library ./library ./tcl8.5.13/library ./tcl8.5.13/library
but i get the above tcl error. since i've seen this in other threads:
> capabilities("tcltk")
tcltk
TRUE
it looks like tcl on my system is 8.6, but i don't know how to tell R to look for that version.
$ whereis tcl
tcl: /usr/lib64/tcl8.6 /usr/include/tcl.h /usr/share/tcl8.6
$ which R
/opt/apps/rhel7/R-3.6.0/bin/R
Any ideas? The OS is CentOS 8. Thanks!
I ended up deciding to try using a more recent R version (4.1.1) to solve this issue. I was hesitant to do this at first because I have run into issues with availability / compatibility of packages I need in more recent R versions, but I wasn't getting anywhere troubleshooting this issue otherwise. I figured that since TCL 8.6 is what was installed on the system, a newer version of R might be able to work with it, and seems i was right, since I got past the first error I was having when I switched.
I did get a new error regarding an issue loading the shared library Libtk8.6.so. So I downloaded the .so file from here and unpacked it to my home directory using rpm2cpio (i don't have root access so i can't just use yum install etc). After that i just had to re-install all my packages for the new R version and it worked!

Error: package ‘rJava’ could not be loaded when installing xlsx

Im trying to install the xlsx package. Installing works fine but when i load the library I get the following error:
> require(xlsx)
Loading required package: xlsx
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: No CurrentVersion entry in Software/JavaSoft registry! Try re- installing Java and make sure R and Java have matching architectures.
In addition: Warning messages:
1: package ‘xlsx’ was built under R version 3.2.3
2: package ‘rJava’ was built under R version 3.2.3
Failed with error: ‘package ‘rJava’ could not be loaded’
I googled around and say that installing the right version of Java might be the issue. However, when I downloaded the newest version and started a new r-session I still get the same issue.
Are there more people experiencing this issue? And some quick fix?
I am using Linux and when I update R or Java to use the rJava library (needed by xlsx) I need to run this commands form a shell (outside the R session)
sudo su -
R CMD javareconf
I hope this helps.

Rcmndr plugin not running

I am trying to run this rcmndr plugin for my class and it's not working. I installed all the necessary packages and it appeared to install correctly but I am getting this package or namespace load failure. The GUI appears for a split second when I enter the library command, then disappears with the error. It seems to be an issue with the namespace and .onattach but I couldn't find any existing answers or resources for this issue.
https://cran.r-project.org/web/packages/RcmdrPlugin.BCA/index.html
> library(RcmdrPlugin.BCA)
Loading required package: Rcmdr
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: sandwich
Rcmdr Version 2.2-3
Loading required package: BCA
Warning: package 'BCA' was built under R version 3.2.3
Loading required package: flexclust
Warning: package 'flexclust' was built under R version 3.2.3
Loading required package: grid
Loading required package: lattice
Loading required package: modeltools
Loading required package: stats4
Error : .onAttach failed in attachNamespace() for 'RcmdrPlugin.BCA', details:
call: get(Menus[m, 5])
error: object 'importRODBCtable' not found
In addition: Warning messages:
1: package ‘RcmdrPlugin.BCA’ was built under R version 3.2.3
2: package ‘Rcmdr’ was built under R version 3.2.3
3: package ‘RcmdrMisc’ was built under R version 3.2.3
4: package ‘car’ was built under R version 3.2.3
Error: package or namespace load failed for 'RcmdrPlugin.BCA'
I got alternative to run this plugin in R commander.
Open R Commander by using:
library(Rcmdr)
R Commander dialogue box will appear.
In R Script load BCA library-
lapply(list('BCA', 'splines', 'RcmdrMisc', 'car', 'sandwich', 'flexclust', 'grid','lattice','modeltools','stats4','RODBC'), require, character.only = TRUE)
Click on Submit button.
If you don't have RODBC package (which is not there in my case), install it separately and then run above commands. To install use:
install.packages("RODBC")
And now you exactly have what you will get after loading RcmdrPlugin.BCA library.
I faced a similar situation. Having tried a bunch of things - none worked - I finally uninstalled R and deleted the remaining files from under the "Program Files" directory in Windows. I then reinstalled R and RcmdrPlugin.BCA and this time it worked.
You could also refer to this URL for help http://r.789695.n4.nabble.com/Unable-to-run-RcmdrPlugin-survival-using-3-2-2-with-Windows-10-td4711796.html

Running strapply in the absence of tcltk in R

I have a data frame with one column carrying a list variable. The list variable contains duplicate elements which I want to remove. The following is the code that I am using:
library(gsubfn)
Loading required package: proto
Could not load tcltk. Will use slower R code instead.
resp$secu <- as.character(lapply(strapply(resp[[7]], "\\w")), unique)
I am using R 3.2.0 version on mac. I tried loading tcltk manually without success:
library(tcltk)
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: X11 library is missing: install XQuartz from xquartz.macosforge.org
Error: package or namespace load failed for ‘tcltk’
I uninstalled library tcltk and tried re-installing but couldn't:
Warning in install.packages :
package ‘tcltk’ is not available (for R version 3.2.0)
I could execute the code and R started without any error messages. But it had taken an hour for a 65k row list to remove the duplicates and the processing yet to complete. Is there a way to improve the speed of strapply without using tcltk library?

Rcmdr Error : .onLoad failed in loadNamespace() for 'tcltk'

I have no idea what I'm doing but I need to use R and Rcmdr for my statistics class. I am running OS X 10.7.5, using 3.1.2 for R.
I have downloaded R.
install.packages("Rcmdr")
Picked a mirror, downloaded all packages. I then typed in
library(Rcmdr)
And received this error:
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: sandwich
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: system2("otool", c("-L", shQuote(DLL)), stdout = TRUE)
error: error in running command
Error: package or namespace load failed for ‘Rcmdr’
sh: otool: command not found
When I do:
capabilities("tcltk")
# [1] TRUE
Have I done something wrong?
The R developers have tried to make a workaround for R not giving a useful error message when Tcl/Tk was not fully supported on a Mac. It seems R 3.1.2 depends on the otool from Xtools for this. However, you can download a patched version of R from http://r.research.att.com/ to remove the error.

Resources