[R] as.environment Error

Greg Snow Greg.Snow at imail.org
Sat May 1 01:04:16 CEST 2010


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.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of mailing-list at gmx.net
> Sent: Friday, April 30, 2010 11:21 AM
> To: r-help at 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_df[,iii]))
> 
> assign(paste("expected_sing_ref",iii,sep=""),c(get(paste("expected_sing
> le_ref",iii,sep=""))), ret)
> 	      }
> <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 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.



More information about the R-help mailing list