Hey Flo,

I'm not entirely sure what you're problem is -- due to the language thing,
probably -- but I think you want a function that will give you (or computes
in an intermediate step) the "edit distance" between strings.  There is the
"sdists" function in the cba package that might help (it can give you the
pairwise distances between a bunch of strings easily), or you can use the
"agrep" function to find approximate matches:

>max.edits <- list(all=1, substitutions=1, insertions=0, deletions=0)
>words <- c("casa", "cosa", "rosa")
>agrep(pattern="casa", x=words, max.distance=max.edits)
[1] 1 2

i.e. "casa" matches (within 1 letter substitution) the 1st and 2nd elements
of the words vector.  "casa" is an approximate match to "casa" and to "cosa"
but not "rosa" because that's two substitutions and we chose a max of one.

- Mose

On Mon, Mar 3, 2008 at 8:47 AM, Flo <[EMAIL PROTECTED]> wrote:

> Ciao a tutti!
>  ho un problema con un esercizio in R.
>
>  In una lista devo trovare tutte le parole che si differenziano per una
> lettera da un'altra parola.
>  Esempio: per "casa": cosa, rosa...
>
>  C'รจ una formula generale da applicare a tutte le parole?
>  Grazie dell'aiuto, Flo
>
>
> ---------------------------------
>
> ---------------------------------
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to