This is copy & paste from my session:

> xyz<-as.vector(c(ls(),as.matrix(lapply(ls(),class))))
> dim(xyz)<-c(length(xyz)/2,2)
> 
> allobj<-function(){
+ xyz<-as.vector(c(ls(),as.matrix(lapply(ls(),class))));
+ dim(xyz)<-c(length(xyz)/2,2);
+ return(xyz)
+ }
> xyz
      [,1]              [,2]       
 [1,] "a"               "character"
 [2,] "aa"              "character"
 [3,] "abc"             "character"
 [4,] "AirPassengers"   "character"
 [5,] "allobj"          "character"
 [6,] "allObjects"      "character"
 [7,] "allObjects2"     "character"
 [8,] "arrayFromAPL"    "character"
 [9,] "classes"         "character"
[10,] "myCharVector"    "character"
[11,] "myDateVector"    "character"
[12,] "myNumericVector" "character"
[13,] "newArrayFromAPL" "character"
[14,] "obj"             "character"
[15,] "objClass"        "character"
[16,] "x"               "character"
[17,] "xyz"             "character"
[18,] "y"               "character"
> allobj()
     [,1] [,2]
> 

As far as I can see, the function allobj has the same expressions as those 
executed from the command line. Why are the results different?
        [[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