Displaying 3 results from an estimated 3 matches for "pat2grep".
2003 Nov 26
0
Question about Unix file paths (and proposal for new regexp class)
...as those who wanted to use regular
> >> expressions no longer would be able to.
>
> Kurt> Right. In any case, an explicit glob() function
> Kurt> seems preferable to me ...
>
> Good idea!
>
> More than 12 years ago, I had a similar one, and wrote a
> "pat2grep()" {pattern to grep regular expression} function
> --- for S-plus on Unix --- which I have now renamed to glob2regexp():
> -- still not really usable outside unix (or windows with the
> 'sed' tool in the path), nor perfect, but maybe a good start:
>
> sys <- function...
1997 Apr 09
1
R-beta: Source code: grep(.) and objects(..., pattern):
...ot;)
} else if (!missing(pos)) {
if (pos < 1 || pos > length(search())) stop("invalid pos value")
} else if (!missing(envir)) { pos <- 0 } else { pos <- -1 }
what <- .Internal(ls(pos, envir, all.files))
if(is.null(pattern)) what else what[grep(pattern, what)]
}
pat2grep <- function(pattern)
{
## Purpose: Change "ls pattern" to "grep regular expression" pattern.
## -------------------------------------------------------------------------
## Author: Martin Maechler ETH Zurich, ~ 1991
sed.cmd <- "'s/\\./\\\\./g;s/*/.*/g;s/?/...
2003 Nov 24
8
Question about Unix file paths
Gabor Grothendieck pointed out a bug to me in list.files(...,
full.name=TRUE), that essentially comes down to the fact that in
Windows it's not always valid to add a path separator (slash or
backslash) between a path specifier and a filename. For example,
c:foo
is different from
c:\foo
and there are other examples.
I'm going to fix this, but I'm wondering whether the fix is