# Re: [R] Suggestion on how to make permanent changes to a singleobject in a list?

From: Peter Waltman <waltman_at_cs.nyu.edu>
Date: Fri, 04 Jan 2008 00:06:49 -0500

> fooStack[[1]] <- fooModifier(fooStack[[1]]) I thought of this idea as well, and may go with it, if the Gabor's environments idea doesn't work

```> snip
>
> Peter, perhaps it would help if you gave us more context into why you
> wanted this done, and perhaps then someone can suggest a more natural
> approach. Perhaps there is a more "R" way to solve your original problem.
```
it's fairly simple, but basically, we have a "cluster" object (which is really just a list) that has several items in it, one of which is something that we call a colslice (basically, just several columns of expression matrices). In reality, this cluster is part of a larger "meta-cluster" for genes from several different organisms.

So, really the structure is:

clusterStack ( == list() )
clusterStack[[ 1 ]] = a cluster of the form:

cluster (== list() )
|
|->>cluster\$bsubt ( == list() )

```       |

|--->cluster\$bsubt\$colslice
|--->cluster\$bsubt\$cols
|--->cluster\$bsubt\$rowslice

|--->cluster\$bsubt\$genes

|->>cluster\$banth ( == list() )
|

|--->cluster\$banth\$colslice
|--->cluster\$banth\$cols
|--->cluster\$banth\$rowslice

|--->cluster\$banth\$genes

```

I'm writing a function that will be called by another which generates the clusters and clusterStack objects, and the inner function should return the results some calculations on the \$colslice and \$rowslice items.

I just wanted to have the inner function to retrieve the row/col slices from a MySQL database in case they haven't been set.

The other workaround is just to make sure that they're already set by the time the function is called, and have the function throw an error if they're not. In fact, that might be the better way to do it, to provide better "encapsulation".

I just wanted to see if it was possible to have the inner function set these.

Thanks for all the suggestions!

Peter

R-help_at_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. Received on Fri 04 Jan 2008 - 05:11:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Jan 2008 - 08:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.