As stated earlier in the thread, this is where you would need to use
get(paste0("bop", im)) [the analogue of assign]. This unwieldiness is
the exact reason that several posters are encouraging you to change your
approach and store these objects in a list ...
On 2024-06-24 8:16 a.m., Steven Yen wrote:
Great, thanks. Eric's suggestion is the most simple. Here's a resulting
problem. In the call to ame.bopa in a loop, I like inputs in the call to
ame.bopa to be bop1, bop2, bop3,... Thanks.
for (im in 1:m) {
ame<-ame.bopa(bop,y1.level=y1value,y2.level=y2value,jindex=jindex1,vb.method="invH",joint12=TRUE,
printing=FALSE,testing=TRUE)
}
On 6/24/2024 7:57 PM, Eric Berger wrote:
assign(paste0("bop",im),boprobit(eqs,mydata,wt=weight,method="BHHH",tol=0,reltol=0,gradtol=1e-5,Fisher=TRUE))
On Mon, Jun 24, 2024 at 2:56 PM Steven Yen <st...@ntu.edu.tw> wrote:
Thanks Eric. I am not following your suggested line. Would you
just edit my line 4? Thanks.
On 6/24/2024 7:51 PM, Eric Berger wrote:
How about
assign(paste0("bop",im), boprobit( etc ))
On Mon, Jun 24, 2024 at 2:41 PM Steven Yen <st...@ntu.edu.tw> wrote:
I would like a loop to
(1) read data files 2010midata1,2010midata2,2010midata3; and
(2) name OUTPUT bop1,bop2,bop3.
I succeeded in line 3 of the code below,
BUT not line 4. The error message says:
Error in paste0("bop", im) <- boprobit(eqs, mydata, wt =
weight, method
= "NR", : target of assignment expands to non-language object
Please
help. Thanks.
m<-3
for (im in 1:m) {
mydata<-read.csv(paste0("2010midata",im,".csv"))
paste0("bop",im)<-boprobit(eqs,mydata,wt=weight,method="BHHH",tol=0,reltol=0,gradtol=1e-5,Fisher=TRUE)
}
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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]]
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.
--
Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Director, School of Computational Science and Engineering
(Acting) Graduate chair, Mathematics & Statistics
> E-mail is sent at my convenience; I don't expect replies outside of
working hours.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.