what happened to missing.pattern.plot or mp.plot? - r

I have the package mi installed.
But when I try to run mp.plot (as Thomas Leeper does in this tutorial:) I get the following error message:
mp.plot(mydf)
Error in mp.plot(mydf) : could not find function "mp.plot"
On one website this is called missing.pattern.plot, but that also does not work:
missing.pattern.plot(mydf)
Error in missing.pattern.plot(mydf) :
could not find function "missing.pattern.plot"
Any idea what the issue might be?
I do not really care much if I cannot use this function, but I'm curious as to what is going on in case I later need to use a graph that I really need.

Related

object 'rlang_tilde_eval' not found after library updates

I have been using the combcoint library for quite some time. Today I installed some new packages in R for my work and since then I have been getting an error, when I try to run the function bayerhanck. The error itself:
Error in p_value_Fisher_bc ~ poly(stat_Fisher_all_bc, 12) * k_dummy :
object 'rlang_tilde_eval' not found
I assume this there is a technical solution to this, but I have not been able to find it.

when I use word2vec::word2vec function I repeatedly get out of session in R server

I have installed this package and tried to use word2vec on my R server.
library(devtools)
install_github("mukul13/rword2vec")
model=word2vec(train_file = "text8",output_file = "vec.bin",binary=1)
But I repeatedly get
Error: 'session is aborted'.
Does anyone know how I can fix it?
Or what I could use instead of word2vec?
Also you can get 'text8' in https://github.com/mukul13/rword2vec <- here
I just find the reason that we have to have a real train_file to the model, i.e. the file has to be at the right directory and it cannot just be null or anything else.

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

Changing function in R namespace

I'm pulling my hair out over this seemingly simple problem. I am trying to change a function in the hglm package; specifically the private hglm.default function.
Here is what I've done:
library(hglm)
e<-loadNamespace("hglm")
unlockBinding("hglm.default",e)
assignInNamespace("hglm.default",...my edits...,ns="hglm",envir=e)
lockBinding("hglm.default",e)
However, when I do
environment(hglm:::hglm.default)
I get
<environment: R_GlobalEnv>
which is problematic; it needs to be in the namespace environment for hglm (<environment: namespace:hglm>) or else it doesn't work. If I try to set the environment with
environment(hglm:::hglm.default)<-e
I get the error
Error in loadNamespace(name) : there is no package called ‘*tmp*’
I've tried all sorts of permutations of this and can't seem strike the right one. I am a total novice on namespaces, etc, so hopefully someone knowledgable can help out!
Thanks in advance.

KFAS package; error with documentation code

This is an example from the KFAS manual page 13. I just tried a copy/paste and this was the result. Any idea what the problem is?
There were additional errors with the rest of the example.
> require(KFAS)
Loading required package: KFAS
> data(GlobalTemp)
> model<-SSModel(GlobalTemp~SSMtrend(1,Q=NA,type= common ),H=matrix(NA,2,2))
Error in ts(x) : object is not a matrix
Did you copy the example by hand? The line in the manual (at least this one: http://cran.r-project.org/web/packages/KFAS/KFAS.pdf) uses this command:
require(KFAS)
data(GlobalTemp)
model<-SSModel(GlobalTemp~SSMtrend(1,Q=NA,type='common'),H=matrix(NA,2,2))
With the ' around common (and it works fs)
However you should have got the "common not found" error message, not the one you quote (except you already have an object named common in your environment), so I don't really know if this answer will help you.

Resources