[R] AGREP

Gabor Grothendieck ggrothendieck at myway.com
Thu Feb 12 07:26:00 CET 2004




1. The agrep function in 1.8.1 is not written entirely in R so
you would have to move the C code over too.

If you have the agrep command at the operating system level
(for windows you can get find it by searching for agrep.exe in
google) you could try something like this:

   readLines(pipe("agrep -1 pattern myfile"))

where you have written out your lines from R to myfile.  If
pipe was not available that far back you could use the system
command and redirect the output to a file and read it into R.

2. I am not sure if this is practical for you but you could try
running agrep, agrep -1, agrep -2, etc. and then
assign each line the number at which it first appears.

---
Date:   Wed, 11 Feb 2004 14:53:33 -0300 
From:   Marcos Sanches <marcos.sanches at ipsos-opinion.com.br>
[ Add to Address Book | Block Address | Report as Spam ] 
To:   R Help <r-help at stat.math.ethz.ch> 
Subject:   [R] AGREP 

 

     Hi all, I have two questions

1 - I have the version 1.4.1 of R, and it doesn't have the 'agrep'
function in the base library. Is there a way to make this funcion
avaliable in R 1.4.1? I mean, how to 'copy' it from R 1.8.1 and 'paste'
it in R 1.4.1?

2 - The AGREP function doesn't give me the Levenshtein distance (edit
distance). Is there a function in R that does it? Is there a way to use
AGREP to acomplish this task? I've written such a function, but it is so
slow (has so many loops) that it is beeing useless. 

TIA




More information about the R-help mailing list