"Points" not available for .C() for package "dprep" - r

I want to perform discretization in order to perform mutual information based feature selection for supervised learning R.
library(dprep)
data(iris)
iris.discme=disc.mentr(my.iris,1:5)
I am getting following error:
Error in .C("Points", as.double(x), as.integer(n), mpoint = double(n),
: "Points" not available for .C() for package "dprep"
Any help would be appreciated.

This looks like a bug in the library "dprep". The error is telling you that there is no C function called "Points", even though disc.mentr() attempted to call this function. I would notify the authors of dprep.
I just looked on CRAN and did not see a library called "dprep". If it was available earlier, that may be a sign that it has been taken down.

Related

How to fix the error "argument "modelName" is missing, with no default" when using MVN package

I am using the MVN package, in R, to find whether each class of the dataset iris is multivariate normal or not.
I used the below code earlier in the day and generated results from it. However, I went to revisit it and now keep getting the following error message:
Error in mvn(data = iris[Species == m[1], 1:4], mvnTest = c("mardia")) :
argument "modelName" is missing, with no default
Can not figure out what this means and how to fix it !
Code:
#Mardia's Test
SM<-mvn(data=iris,subset="Species", mvnTest="mardia")
SM$multivariateNormality
SetosaPlot<-mvn(data=iris, subset="Species", multivariatePlot="qq")
You loaded the mclust package. When you did so you should have seen a warning
The following object is masked from ‘package:MVN’: mvn
So now mvn() is calling mclust::mvn() (i.e. the mvn function in the mclust package) rather than MVN::mvn().
In general you can make sure you get the version from the MVN package by using
MVN::mvn(data=iris, subset="Species", multivariatePlot="qq")
If you want to know where R is finding mvn, try find("mvn")
In general, to resolve these kinds of problems you should start a clean R session, so that you know you're starting with no packages loaded.
(By the way, no real data set is ever truly multivariate normal; you're not testing "whether it is MVN or not", but rather whether it is close enough to MVN that you can't reject the null hypothesis of multivariate normality ...)

How can I install and use (mice) function in R?

I want to use mice function to handle the missing data that I have in (data). I installed the package and I called the library. However, when I am trying to apply the function to my data it gives me error as below:
(Error in mice(data[, 5:9], m = 3, seed = 123) :
could not find function "mice")
I have a normal data frame that includes NAs
install.packages('mice')
library(mice)
library(VIM)
md.pattern(data)
md.pairs(data)
My_New_Data <- mice(data[,5:9], m=3, seed=123)
I am expecting the function to solve the problem and replace the NAs with reasonable values. It did not work at all!
Edit (incorporating comment suggestion)
In the comments the running mice::mice(data[, 5:9], m = 3, seed = 123). I ran this and the following error was returned.
Error in get(Info[i, 1], envir = env):
lazy-load database 'C:/Users/MUSTAFA KAMAL/Documents/R/win-library/3.5/broom/R/broom.rdb' is corrupt
In addition:
Warning message: In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
In order to incorporate an answer to this question, I will rewrite my comment which resolved the problem, in the form of a short answer.
From the comments executing mice::mice(data[, 5:9], m = 3, seed = 123) resulted in an error message, showing the directory ~/Documents/R/win-library/**3.5**/broom/R/broom.rdb being corrupt.
From the corrupted directory path, one can see that OP was running R-3.5.x, while the newest version is R-3.6.x. Some packages updated since the most recent R-update has experienced similar problems, as such a first step towards solving these types of issues is updating R. The installr contains the function updateR which can help smooth over such updates, while also updating any outdated packages.
As a side note, an update sometimes fails to update the actual packages or results in other packages being corrupted, as such if an error persists one solution is to simply delete and re-install the package (or the entire ~/Documents/R/win-library/3.z/ directory). In the question from OP the corrupt package is the broom package, as such one could re-install this package by running
remove.packages("broom")
install.packages("broom")
which should resolve any leftover issues. Note however multiple packages might be corrupt, and likely only one will be shown every time the function is executed. In such cases a full package clear will do the trick, but requires re-installing all packages. For this one can export all installed packages prior to removing them all, by noting that a full list of installed packages is contained in installed.packages(), which can then be exported to a file with for example write.table or write.csv.

PreprocessCore package

I'm quite new to R and I got an assignment that includes a sourcecode.
Part of the source code includes the following line:
library(preprocessCore)
Then I have in my source code a definition of the following function:
quantile.normalize.raw.gtex <- function(edata.mat)
{
norm_edata = normalize.quantiles(as.matrix(edata.mat))
rownames(norm_edata) = rownames(edata.mat)
colnames(norm_edata) = colnames(edata.mat)
return(norm_edata)
}
Finally, I have an object being initialized to the output of this function, after sending a predefined parameter:
tissue.edata.qn = quantile.normalize.raw.gtex(tissue.edata)
From what I understand, the library function is supposed to include the function normalize.quantiles, which is called in the function that is defined in my source code.
However, when I run the line library(preprocessCore) I get the following error:
Error in library(preprocessCore) :
there is no package called ‘preprocessCore’
I also tried to run the rest of the code and got the error:
Error in normalize.quantiles(as.matrix(edata.mat)) :
could not find function "normalize.quantiles"
I looked for the preprocessCore online and eventually I tried to write install.packages("preprocessCore"), but I got a warning message that this package is only available in version 3.6.0 of R, even though I checked and this is the version that I have.
If somebody has any idea what the problem is, I will appreciate your help.
Thanks in advance
The preprocessCore package is available in Bioconductor. So, to install it, you need the following lines:
source("http://bioconductor.org/biocLite.R")
biocLite("preprocessCore")
After that, you can load the package using library(preprocessCore)
Hope it helps.

R '.doSnowGlobals' not found

I am working with the package random uniform Forest. I am trying to run the examples provided in the documentation:
data(iris)
XY = iris
p = ncol(XY)
X = XY[,-p]
Y = XY[,p]
iris.ruf = randomUniformForest(Species ~., XY, threads = 1)
But I get this error:
Error in checkForRemoteErrors(lapply(cl, recvResult)) :
7 nodes produced errors; first error: object '.doSnowGlobals' not found
I googled and found that this is because it is trying to use paralell computing and it does not find something it needs. I have never used paralell computing so I did not understand the explanations I have found and I do not know how to fix this problem. I also read "error: object '.doSnowGlobals' not found?".
According to the manual using "threads = 1" deactivated paralell computing, but I get the error anyways.
I have also checked and the packages paralell and doParallel are loaded.
I do not really need paralell computing and I do not know if I am "connected" to other computers, so I am not sure If that would even work. Would there be an easy way do deactivate paralell computing? Or another alternative for making this work?
The cause of the problem was that I was working on my university computer for which I do not have administrator rights. The randomUniformForest package makes use of parallel processing which uses the IP protocol (even when only one thread is used).
I tried the package on my private computer and it worked fine.

Problems building an R package (NAs introduced by coercion)

I have written the Boggler package which includes a Play.Boggle() function that calls, on line 87, a progress bar script using shell:
shell(cmd = sprintf('Rscript.exe R/progress_bar.R "%i"', time.limit + 1), wait=FALSE)
Everything works fine when sourcing the files individually and then calling the main Play.Boggle() function, but when I try to check/build the package (under Win7-64 using RStudio), I get a failure message -- here's what the 00install.out reports:
** preparing package for lazy loading
Warning in eval(expr, envir, enclos) : NAs introduced by coercion
Error in time.limit:0 : NA/NaN argument
To make sure the argument "%i" (time.limit + 1) was correctly passed to the progress_bar.R, I added a cat(time.limit) to the script (commenting the rest out to make sure the package would build without any errors) and directed its output to a log file like this:
'Rscript.exe R/progress_bar.R "%i" > out.log'
Conclusion: the time limit is indeed passed along as expected. So I can't figure out why I get this "NA/NaN argument" error message. It must have something to do with lazy loading, concept that I haven't fully got my head around yet.
So my question is: what can I do to successfully check/build this package with full functionality (including progress_bar.R)?
Note: On github, the progress_bar.R script is there but all its content is commented out so that the package can successfully be installed. The shell(...) function call is still active, doing nothing but executing an empty script.
So the problem arises when trying to build or check, in which case all R scripts are executed, as pointed out by Roland. A simple workaround allows the package to check/build without any problems. The fix is just to add to the progress_bar.R the following lines after it tries to recuperate the commandargs (lines 10-11):
if(time.limit %in% c(NA, NaN))
time.limit <- 10 # or any minimal number
There's surely other ways to go about this. But this being a game programmed for fun, I'll happily go with that patch. Hopefully this can be of help to someone down the road and I won't have wasted 50 precious rep points in vain for that bounty! :D

Resources