> -----Original Message-----
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of Greg Snow
> Sent: Friday, April 30, 2010 4:04 PM
> To: mailing-l...@gmx.net; r-help@r-project.org
> Subject: Re: [R] as.environment Error
> 
> I don't know what is specifically causing the error, but I 
> think that you will be happier in the long run (and probably 
> short run) if you abandon the use of assign and <<- and 
> instead use lists.
> 
> -- 
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
> 
> 
> > -----Original Message-----
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > project.org] On Behalf Of mailing-l...@gmx.net
> > Sent: Friday, April 30, 2010 11:21 AM
> > To: r-help@r-project.org
> > Subject: [R] as.environment Error
> > 
> > 
> > Dear R community,
> > 
> > I have a problem with assign:
> > 
> > <snip>
> >           for ( iii in 1:dim(ref_df)[2] )
> >           {
> >                 ret <<-
> > 
> ref_df[,iii][names(single_string[ii])]*(single_count/sum(ref_d
> f[,iii]))
> > 
> > 
> assign(paste("expected_sing_ref",iii,sep=""),c(get(paste("expe
> cted_sing
> > le_ref",iii,sep=""))), ret)

That assign() call is equivalent to
   assign(x=paste(...), value=c(get(paste(...))), pos=ret)
and the subsequent envir=as.environment(pos) causes the
error you got.

Did you misplace the closing parenthesis in the call to c()
so ret became the 3rd argument to assign()?

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> >           }
> > <snap>
> > 
> > The Error:
> > Error in as.environment(pos) : invalid argument
> > 
> > Has anybody an idea, how to solve this error ?
> > 
> > Thanks in advance,
> > Georg
> > 
> > ______________________________________________
> > 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.
> 
> ______________________________________________
> 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.
> 

______________________________________________
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