Search code examples
regexrstringdna-sequencestringi

Using stri_count_fixed with overlap=TRUE returning an error of Incorrect number of arguments


Today I saw a new post regarding a new add to the stringi package where you would be able to add the argument "overlap=TRUE" to some of the stringi search functions.

This is the post.

However, I've tried the exact code that bartektartanus suggested (from installing to the example), and when I run it I get an error of Incorrect number of arguments (3), expecting 2 for 'stri_count_fixed'

> library("stringi", lib.loc="D:/Program Files/RRO/R-3.1.1/library")
> DNAlst<-list("CAAACTGATTTT","GATGAAAGTAAAATACCG","ATTATGC","TGGA","CGCGCATCAA")
> dna <- stri_paste(rep(c("A","C","G","T"),each=4),c("A","C","G","T"))
> result <- t(sapply(DNAlst, stri_count_fixed,pattern=dna,overlap=TRUE))
Error in .Call("stri_count_fixed", str, pattern, overlap, PACKAGE = "stringi") : 
  Incorrect number of arguments (3), expecting 2 for 'stri_count_fixed'
> colnames(result) <- dna
Error in colnames(result) <- dna : object 'result' not found

I'm wondering if this is because this is something really new, or if I'm doing something wrong.

Devtools version: 1.6
Stringi version: 0.3-1
R version = 3.1.1 (RRO 8.0 beta)
64bits running on Windows 8.1


Solution

  • The problem happened because R was trying to find Rtools, but it couldn't. The system shortcut was wrong. And you need Rtools for the proper execution of devtools. The sad thing is that I figured out this when I was doing something completely unrelated even with Rtools and devtools lol...

    > library("devtools", lib.loc="D:/Program Files/RRO/R-3.1.1/library")
    WARNING: Rtools is required to build R packages, but the version of Rtools previously
    installed in F:/Program Files/Rtools has been deleted.
    

    After re-installing Rtools from this cran link, the program worked as it was supposed to.

    However, the installation of this version of stringitook almost half an hour to complete.