Dear All,
I have discovered that it is often the case that you will need to use
assign(?object?,object,immediate=T,frame=1) inside a function if you
want to use the lapply command in the following form:
Some.func<-function(object){
assign(?object?,object,immediate=T,frame=1)
lapply(1:10, function(i) object[[i]])
}
Alternatively I can get function to work by using <<-
Some.func<-function(object){
object<<-object
lapply(1:10, function(i) object[[i]])
}
The downside of using <<- is that it creates the object as a permanent
object but it does seem to help my simulation runs a lot faster. I am
thinking of using <<- and then use rm(object) at the end to remove the
object, so I can make my simulation run faster without creating a huge
list of objects in my directory. I am wondering if there is an
alternative way of doing this?
All comments are welcome!
************************************************************************
**************
Steve Su (s.su@qut.edu.au)
PhD student.
School of Accountancy
School of Mathematical Sciences
Queensland University of Technology
Postal Address: Steve Su, School of Accountancy, QUT, PO Box 2434,
Brisbane,
Queensland, Australia, 4000.
Phone: +61 7 3864 2017
Fax: ; +61 7 3864 1812
Mobile: 0421 840 586
.
_--_|\
/ QUT
\_.--._/
v
************************************************************************
**************
|