'Error: could not find function runmean' from an installed package: caTools?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



'Error: could not find function runmean' from an installed package: caTools?



I installed 'caTools' R package through the command line:


$ R
$ install.packages("caTools", lib="~/R/library")



Then, did this command:


INPUT=/home/user/file.bam
OUTPUT=/home/user/file_cor.bam
Rscript run_spp_nodups.R -c=$INPUT -savp -out=$OUTPUT



And got the error:


Error: could not find function "runmean"
Execution halted



The function 'runmean' belongs to package I installed, 'caTools'.
The R version is appropriate, as R in my machine is version 3.3.2 and 'caTools' depends on R (≥ 2.2.0).



The R code of 'run_spp_nodups.R' is to big to paste here. I show only the part with runmean:


# Smooth the cross-correlation curve if required
cc <- crosscorr$cross.correlation
crosscorr$min.cc <- crosscorr$cross.correlation[ length(crosscorr$cross.correlation$y) , ] # minimum value and shift of cross-correlation
cat("Minimum cross-correlation value", crosscorr$min.cc$y,"n",file=stdout())
cat("Minimum cross-correlation shift", crosscorr$min.cc$x,"n",file=stdout())
sbw <- 2*floor(ceiling(5/iparams$sep.range[2]) / 2) + 1 # smoothing bandwidth
cc$y <- runmean(cc$y,sbw,alg="fast")



What's happening and how to solve it?





You've failed to supply your R code for the run_spp.R script - we aren't able to tell you exactly why if we can't see what you are attempting to run.
– zacdav
Aug 6 at 9:09


run_spp.R





Add library(caTools) in front of your code to activate your package.
– jaySf
Aug 6 at 9:09


library(caTools)





I only added the part with runmean cause the Rscript is too big, it exceeds the limit of words to post
– salamandra
Aug 6 at 9:32





don't know how can I add library(caTools) from the commandline? Or are you suggesting to add in the script?
– salamandra
Aug 6 at 9:32






Sure, add it into the script, the code needs activated library in order to run.
– jaySf
Aug 6 at 13:35









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard