> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Greg Snow > Sent: Friday, April 30, 2010 4:04 PM > To: [email protected]; [email protected] > 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 > [email protected] > 801.408.8111 > > > > -----Original Message----- > > From: [email protected] [mailto:r-help-boun...@r- > > project.org] On Behalf Of [email protected] > > Sent: Friday, April 30, 2010 11:21 AM > > To: [email protected] > > 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 > > > > ______________________________________________ > > [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. > > ______________________________________________ > [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. > ______________________________________________ [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.

