Thanks a lot guys!

On Mon, Feb 13, 2012 at 1:26 PM, William Dunlap <[email protected]> wrote:

> Replace the syntax List$Name with List[["Name"]]
> and see if things work better.
>
> '[[' does not do the partial matching that '$' does.
> E.g.,
>   x <- list(AB=10, BC=20, CD=30)
>   x$A # returns 10 because "A" is the initial part of exactly one name in
> x, "AB"
>   x[["A"]] # returns NULL
>
> However, if you have
>   y <- list(AB=1, AC=2, AD=3)
> then y$A will return NULL because there is not a unique partial
> match to "A" among the names of y.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]]
> On Behalf Of Michael
> > Sent: Monday, February 13, 2012 11:00 AM
> > To: r-help
> > Subject: [R] Puzzling... puzzling... puzzling...
> >
> >  Hi all,
> >
> > I made sure that it's "env$sRes1$nPositionsOptimizedM" that's correct...
> >
> > not the "env$sRes1$nPositionsOptimized"...
> >
> > But it seems both point to the same memory area...
> >
> > This is very dangerous because I have used naming conventions such as:
> >
> > MyLongVariableNameForA
> >  MyLongVariableNameForB
> >  MyLongVariableNameForC
> > ...
> > ...
> >
> > Then if internally they are actually the same thing then all my programs
> > messed up...
> >
> > Any thoughts?
> >
> > >env=new.env()
> >
> > >load("MyResults.rData", env)
> >
> > >identical(env$sRes1$nPositionsOptimized, env$sRes1$nPositionsOptimizedM)
> >
> > [1] TRUE
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [email protected] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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