search for: objectx

Displaying 2 results from an estimated 2 matches for "objectx".

Did you mean: objects
2011 Sep 08
0
Consistently printing the name of an object passed to a function; & a data-auditing question
...0-year annual survey, they add two more allowable answers to a question. etc. I'm looking for things to make my data auditing go faster. One of them is a dopy little function, testX(), bundling together a variety of r tools to tell me what is in an object. Here it is: testX <- function(objectX, bar=TRUE) { # A useful diagnostic function object.name <- deparse(substitute(objectX)) if(bar) cat("########################\n"); # visual separation between consecutive objects. cat("testX(", object.name, "): "); cat("Class=", class(obje...
2011 Sep 15
2
Returning the name of an object passed directly or from a list by lapply
Dear folks: Let?s suppose I want a function to print return the name of the object passed to it. > myname <- function(object) {out<-deparse(substitute(object)); out} This works fine on a single object: > O1 <-c(1:4) > myname(O1) [1] "O1" However it does not work if you use lapply to pass it the same object from a list: > O2 <-c(1:4) > object.list <-