[R] get() with complex objects?

2007-07-27 Thread Mark Orr
Hello R-listers, I'm having trouble accessing sub objects (attributes?), e.g., x$silinfo$avg.width using the /get() /command; I'm using/ get()/ in a loop as illustrated in the following code: #FIRST MAKE CLUSTERS of VARYING k /for (i in 1:300){ assign(paste(x.,i,sep=),pam(x,i)) #WORKS

Re: [R] get() with complex objects?

2007-07-27 Thread jim holtman
'get' tries to retrieve the object given by the character string. The error message says that object can not be found. You actually have to 'evaluate' the character string. See the example below: x - data.frame(a=1:10, b=11:20) x$a [1] 1 2 3 4 5 6 7 8 9 10 z - 'x$a' get(z) Error