John Beyer
2016-Jan-12 21:22 UTC
[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:
This is what I get when i try to run dir or ls on my R Console: getwd() [1] "/Users/johnbeyer"> dirfunction (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>> lsfunction (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]]
William Dunlap
2016-Jan-12 22:58 UTC
[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:
> getwd()[1] "/Users/johnbeyer" > dir function (path = ".", pattern = NULL, all.files = FALSE, full.names FALSE, recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE, Note what a difference the parentheses after the function name make. With parentheses, often with arguments in the parentheses, you call the function; without parentheses you get the function definition, Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, 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 > 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 > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
David Winsemius
2016-Jan-12 23:00 UTC
[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:
> 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> >> lsIf 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 > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius Alameda, CA, USA