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.
Related
Did anyone used the AutoSpearman function from "software-analytics/Rnalytica" package and worked for him? I keep having errors while loading the package. You can find here the documentation of AutoSpearman function.
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.
I am currently developing an R package and would like to make use of parallelization with the package snowfall. I'd like to call a function (actually an Rcpp wrapper if this matters) from the package itself, so the function is currently not floating around in the environment.
sfInit(parallel=TRUE,cpus=Cpu)
sfExport("RcppFunction")
sfLapply(1:N,function(cc) RccpFunction(args))
sfStop()
Anytime I try to do this I get the following error message:
Error in sfExport("RcppFunction") :
Unknown/unfound variable RcppFunction in export. (local=TRUE)
I already tried some tutorials and online handbook, but did not found yet the solution how to export any function to snowfall within a package. As far as I see it doesn't really have to do that this particular function is an RcppFunction. I hope someone can help! Thanks in advance!
PS: I already found this post, but I cannot export my own package to snowfall - at least this doesn't make sense to me.
I created some functions and try to build a package/library, but run into some problems. I hoped to get some advise here on this support site.
This is how I tried to built my package.
I had some functions in an R file, including roxygen2 comments.
Then in R
library("devtools")
library(roxygen2)
setwd("C:to/my/directory")
create("myPackage")
Then I put my functions file in the R folder and changed the DESCRIPTION file.
setwd("./myPackage")
document()
setwd("..")
install("myPackage")
library(myPackage)
Then, when I want to see how a function works
?function1
I see the documentation in my browser.
But when I want to use my function I get an error.
function1
Error: object 'function1' not found
function1()
Error: could not find function "function1"
Does anyone know what I am doing wrong? I am using R 3.3.1 on Windows 7.
Your help or comments are appreciated, thanks in advance!
Ben
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