[R] Running R 3.2.2 on Mac OS X 10.11.3 - not getting proper response to ls and dir commands ... launching error scripts. See below:

David Winsemius dwinsemius at comcast.net
Wed Jan 13 00:00:13 CET 2016


> On Jan 12, 2016, at 1:22 PM, John Beyer <johnbeyer at me.com> wrote:
> 
> This is what I get when i try to run dir or ls on my R Console:
> 
> 
> getwd()
> [1] "/Users/johnbeyer"
>> dir
> function (path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, 
>    recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE, 
>    no.. = FALSE) 
> .Internal(list.files(path, pattern, all.files, full.names, recursive, 
>    ignore.case, include.dirs, no..))
> <bytecode: 0x7f8b48c1d428>
> <environment: namespace:base>
>> ls

If you want to use the `ls` function, at a minimum you must enter 4 keystrokes:

ls()

R is a functional language and has a syntax that requires that all functions have a name, opening parenthesis, argument list (possibly empty as in this case) and then closing parenthesis. This should have become apparent as you worked through the material in "Introduction to R".

Just typing a literal function name with no parentheses returns the value of the function name which is code.

-- 
David.


> function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE, 
>    pattern, sorted = TRUE) 
> {
>    if (!missing(name)) {
>        pos <- tryCatch(name, error = function(e) e)
>        if (inherits(pos, "error")) {
>            name <- substitute(name)
>            if (!is.character(name)) 
>                name <- deparse(name)
>            warning(gettextf("%s converted to character string", 
>                sQuote(name)), domain = NA)
>            pos <- name
>        }
>    }
>    all.names <- .Internal(ls(envir, all.names, sorted))
>    if (!missing(pattern)) {
>        if ((ll <- length(grep("[", pattern, fixed = TRUE))) && 
>            ll != length(grep("]", pattern, fixed = TRUE))) {
>            if (pattern == "[") {
>                pattern <- "\\["
>                warning("replaced regular expression pattern '[' by  '\\\\['")
>            }
>            else if (length(grep("[^\\\\]\\[<-", pattern))) {
>                pattern <- sub("\\[<-", "\\\\\\[<-", pattern)
>                warning("replaced '[<-' by '\\\\[<-' in regular expression pattern")
>            }
>        }
>        grep(pattern, all.names, value = TRUE)
>    }
>    else all.names
> }
> <bytecode: 0x7f8b4a861350>
> <environment: namespace:base>
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list