'tk_chooseDirectory' is not an exported object from 'namespace:tcltk' - r

I am following code from this guidebook, https://www.adb.org/sites/default/files/publication/698091/guidebook-mapping-poverty-data-integration-ai.pdf
And inputted
wd <- tcltk::tk_choose.dir(caption ="Select Working Directory") into R
but received the error message Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] invalid command name "tk_chooseDirectory".
When I changed it to wd <- tcltk::tk_chooseDirectory(caption ="Select Working Directory")
I get the error
Error: 'tk_chooseDirectory' is not an exported object from 'namespace:tcltk'.
The only lines of code I have before these are installing packages, but since tcltk is a base package of R, it's unlikely that's the problem.
How do I solve this? Thank you! I've attached a photo of the example code.

Related

Error: 'set_envvar' is not an exported object from 'namespace:xfun'

I'm trying to run Data Exploration in my R Studio, version 1.3.959 on my windows10.I wrote following test code
if (!require(devtools)) install.packages("devtools")
devtools::install_github("boxuancui/DataExplorer", ref = "develop")
library(DataExplorer)
diabetes_data <- read.csv("https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.csv", header = FALSE)
names(diabetes_data) <- c("number_of_times_pregnant", "plasma_glucose_conc", "diastolic_bp", "triceps_skinfold_thickness", "two_hr_serum_insulin", "bmi", "diabetes_pedigree_function", "age", "label")
# create report
create_report(diabetes_data)
But I'm getting error message
Error: 'set_envvar' is not an exported object from 'namespace:xfun'
Can you please help me to resolve the issue?
I just had this problem and updating my packages solved the issue, especially the package xfun from which set_envvar is originated.

Error in .External2(C_dataviewer, x, title) : unable to start data viewer

In R I get the following errors any time I hit View() or data.frame and I do not understand why. It happened suddenly.
> View(Fhat_all)
Error in .External2(C_dataviewer, x, title) : unable to start data viewer
In addition: Warning message:
In View(Fhat_all) : unable to open display
> da <- data.frame(comb[true_comb_RMSE[1],1], comb[true_comb_RMSE[1],2],
comb[true_comb_KS[1],1],comb[true_comb_KS[1],2])
Error in (function (env, objName) :
could not find function "object.size"
I checked this other page in Stackoverflow Can't use either View() or edit() functions, getting "Error in .External2(C_dataviewer, x, title) : invalid device" error message but I didn't understand how to fix it. So I hit locale on terminal and got this result:
Last login: Mon Mar 21 16:47:07 on ttys000
MacBook-Pro:~ "username"$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
MacBook-Pro:~ "username"$ LC_CTYPE = C R
-bash: LC_CTYPE: command not found
so I hit LC_CTYPE=C R on the the terminal as by suggestion and tried to view a vector in R, but I got the same error message:
> View(w)
Error in .External2(C_dataviewer, x, title) : unable to start data viewer
In addition: Warning message:
In View(w) : unable to open display
Can you please help me? Thank you.
I had the same issue. I opened XQuartz and then the View() function worked.
Experienced this after updating some packages.
Restart R worked for me (in RStudio: Ctrl+Shift+F10). After that, the error vanished and View worked well again.
I had the same error when using the jagsUI package, which masks the View function. Perhaps you have conflicts between packages?
Check potential conflicts between functions by calling conflicts(detail=TRUE) (Taken from this answer for finding which functions are masked in R).
Easiest workaround in my case was calling detach("package:jagsUI", unload = TRUE) once I finished using JAGS.
Delete the view(), then it will work!

Error using DEXSeqDataSetFromHTSeq

Currently I am trying to understand DEXSeq package. I have a design tsv file and 7 files which contains Counts. Now would like to run the following command
library("DEXSeq");
design=read.table("dexseq_design.tsv", header=TRUE, row.names=1);
ecs = DEXSeqDataSetFromHTSeq(countfiles=c("M0.txt", "M1.txt", "M2.txt", "M3.txt", "M4.txt", "M5.txt", "M6.txt", "M7.txt"), design=design, flattenedfile="genome.chr.gff");
The last command gives and error
Error in class(sampleData) %in% c("data.frame") :
error in evaluating the argument 'x' in selecting a method for function '%in%':
Error: argument "sampleData" is missing, with no default
What does this error means and how to fix it? While loading the package DEXSeq there was a warning
Warning message:
replacing previous import by ‘ggplot2::Position’ when loading ‘DESeq2’

Error when using ape::root in R

I'm trying to use root from the ape package in R, but I keep getting the following error:
Error in FUN(X[[i]], ...) : object 'fuseRoot' not found
Here is the code that isn't working:
mammal.trees <- lapply(mammal.trees, root, "Gal", resolve.root=TRUE)
I'm stumped because the same code works for another multiPhylo object just fine.

RWeka read.arff issues

I am reading a (sparse) arff using read.arff method of RWeka package. However I get the following error:
Error in .jnew("java/io/FileReader", file) :
java.io.FileNotFoundException: (No such file or directory)
The file I am trying to read in exists (file.exists('myfile.arff') return TRUE).
My one line code is:
data = read.arff(system.file('arff', 'myfile.arff', package='RWeka'))
Any ideas what might be going on?
Thanks.
Edit 1: traceback() output
> traceback()
4: stop(list(message = "java.io.FileNotFoundException: (No such file or directory)",
call = .jnew("java/io/FileReader", file), jobj = <S4 object of class "jobjRef">))
3: .External("RcreateObject", class, ..., silent = silent, PACKAGE = "rJava")
2: .jnew("java/io/FileReader", file)
1: read.arff(system.file("arff", "/home/andy/r/myfile.arff",
package = "RWeka"))
You seem to be using the format of the example in help(read.arff) without understanding why it is written using the system.file() function. If your .arff file is not in the package directory (and it does not appear to be so located), then you should not be using that function. Try instead:
mydat <- read.arff(file= "/home/andy/r/myfile.arff")
Or maybe just this if it is in your working directory:
mydat <- read.arff(file= "myfile.arff")

Resources