I'm trying to use the Psycho package to analyze a model. I've tried installing Psycho through CRAN as well as install_github and the installation worked. The package is loaded but the analyze function is not being recognized. I've tried psycho::analyze which also does not work. Following this question I also installed and loaded statnet.common. Any suggestions?
Error in analyze(m2, CI = 95) : could not find function "analyze"
For any future person that comes across this, I was also having problems with the analyze() function. One can use the following solution that worked for me:
> install.packages("remotes")
> remotes::install_github("easystats/report")
> library("report")
> report(m2) # use this instead of analyze()
I had the same issue while trying to follow this tutorial: https://neuropsychology.github.io/psycho.R//2018/05/01/repeated_measure_anovas.html
(and I wish it was updated, unfortunately it still refers to outdated functions).
Potential solutions (alternative library) are discussed on this page: https://github.com/easystats/easystats/issues/58
Unfortunately, I have not managed to get these to work, but other people commented that the solutions worked for them.
Related
I'm trying to work through some of the examples in this article around table generations using expss - https://cran.r-project.org/web/packages/expss/vignettes/tables-with-labels.html - however, I am consistently getting the error could not find function "setalloccol" using the most basic crosstab functions of cro and fre with two variables:
> cro(df$var1, df$var2)
Error in setalloccol(ans) : could not find function "setalloccol"
I'm using R Studio 1.2.1335 and I've re-installed the packages dplyr, data.table, tidyr and expss itself, but I still seem to get this error with all these libraries running. I've googled the exact error I'm coming up with and there is absolutely zilch on this, so appreciate any help...
Try to explicitly export setalloccol from data.table before running your code:
setalloccol = data.table::setalloccol
# further calculations
# cro(df$var1, df$var2)
'Setalloccol' is an experimental command in data.table used to allocate memory by reference to assure something more stable than a shallow copy is allocated by ':='. 'Expss' looks like a monster library. I won't load it now and track down your error. But since 'setalloccol' is an experimental command, you should find the 'expss' developers and file a defect. There is, however, already a whole gnarly open bug report on this exact issue here: https://github.com/gdemin/expss/issues/42. The developer of data.table ("Matt Dowle") has comment in that bug report. In practice setalloccol works like this:
help(setalloccol)
data.table::truelength(HMR)
[1] 1035
options(datatable.verbose=TRUE)
data.table::setalloccol(HMR,2 * 1035)
data.table::truelength(HMR)
[1] 2081
But it really isn't necessary for most data.table computations. Try to pour over the "expss" code and find why and when they use it. Sorry I am not more helpful.
Thanks to rferrisx for the thread from GitHub. The post from josie-athens from 3rd Nov 19 seems to fix this issue, though I didn't run R from Bash. So my process was:
Uninstall expss and data.table packages: remove.packages(c('expss','data.table'))
Reinstall above packages: install.packages(c('data.table','expss'))
This seems to bypass the error. Not entirely sure why though but hopefully helpful for somebody experiencing the same thing.
For what it's worth, I just ran into the same issue and wanted to give my two cents. This seems to be a matter of the order in which you load the packages, since the "expss" package masks several functions of the "data.table" package and vice versa. Try reversing the loading order. At least that solved the issue for me.
I am trying to create a character map and was recommended to use Phylotools and Ape packages in R.
I have installed the packages but when I try to do function getStates it comes up with an error message:
x<-getStates(nexdata,"tips")
Error in getStates(nexdata, "tips") : could not find function "getStates"
I have installed the right packages (so I think) and I am quite stuck. Any help would be really appreciated. If you need me to explain anything in more detail let me know.
The function library() loads and attaches add-on packages. You are using phytools and ape, so you should have in your code
library(phytools)
library(ape)
You can read more in the documentation, e.g. at rdocumentation.org/packages/base/versions/3.6.1/topics/library.
I'm an R package author, and I received a notice form CRAN that my package was going to be archived because the packages in my Suggests need to be used conditionally. In my main code, they are used conditionally; I wrote a check.packages() function that throws an error if the package is not able to be loaded. In the examples in my Help files, though, I simply attach the package with library(), which is likely where I made my mistake. The problem arose because a package I included in Suggests was archived.
My question is how do I conditionally use packages in examples in Help files? I tried using
ifelse{\Sexpr{isTRUE(requireNamespace("pkg"))}}{
#Example with pkg
}{
\dontrun{
#Example with pkg
}}
that is, if the package is loadable, display the example as usual, and if not, wrap \dontrun{} around it. This worked when I previewed the Help file, but the CRAN check tells me I can't use \ifelse in examples. If it's important that my examples attach packages in my Suggests, is my only option to wrap \dontrun around all of them, regardless of whether the package can be loaded?
CRAN were happy with a simple if statement in the vignette of one of my packages:
if (requireNamespace('pkg', quietly = TRUE)) {
library('pkg')
# Example with pkg
} else {
message("'pkg' not available")
}
I could be missing something, but I can't see why this approach shouldn't work in examples too; perhaps you would need to add an unloadNamespace('pkg') after the example to clean up?
I would like to apply the function 'fit.tcopula' from the package 'QRM' - Quantitative Risk Management and get the following error message:
fit.tcopula(Udata, method = 'Kendall')
Error: could not find function "forceAndCall"
Since I have applied the 'Udata' to different copulas from the package 'copula' already - and it worked fine - I assume the input is not an issue.
To my understanding 'forceAndCall' is part of the base package. I use the R version 3.1.3.
According to the documentation the QRM package depends R(>=3.0.1), so my version should be OK. However, listing all functions of my base package with
library(help = 'base')
reveals that the forceAndCall-Function is not there. What would the remedy be? Installing R version 3.2.1?
The reason I ask and not just do it is that I do not possess admin rights for my PC and therefore would be happy to get an opinion beforehand.
I posted the question though I already have the answer as it might be interesting to others.
Upgrading to R version 3.2.1 is the/one solution to the problem!
How does one look up the help manual page for a function and specify the package in R? For example, count appears in both seqinr and plyr. If I want to look up count in plyr, what's the command? I've tried a few obvious (but wrong) guesses such as "?plyr::count"
EDIT:
When I do ?count, I get the following message:
Help on topic 'count' was found in the following packages:
Package Library
plyr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
seqinr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
When I do ?plyr::count, I get:
No documentation for 'plyr::count' in specified packages and libraries:
you could try '??plyr::count'
When I do ?plyr:::count, I get:
No documentation for 'plyr:::count' in specified packages and libraries:
you could try '??plyr:::count'
Adding two question marks also gets me a no documentation found error as well. Looking up help for non-ambiguous funcitons is working fine (e.g. ?plot)
This is with R 2.15.0 on OSX running in emacs + ESS.
Use the package= argument to help:
help("count", package="plyr")
The correct way to do this is:
?plyr::count
?plyr:::count
See ?"?" for details - both examples are shown.
Both work for me with both packages loaded and even without the package loaded. That begs the question if you have the packages installed?
You were close, you need three : :::
?seqinr:::count # for seqinr
?plyr:::count # for plyr