Re: [R] Naming output file

2024-06-24 Thread avi.e.gross
I had the same FIRST impression which could have made sense as in writing the data back out to a file with a similar name and that would have been trivial. I mean if you had exactly three, a loop would not even be particularly useful versus writing two lines, copying them and editing the latter two

Re: [R] Naming output file

2024-06-24 Thread Richard O'Keefe
The subject line says (capitalisation changed) "name output FILE" but I see no attempt in the sample code to create an output FILE. I was expecting to see something like write(, file = paste0("bop",im)) On Mon, 24 Jun 2024 at 23:41, Steven Yen wrote: > > I would like a loop to > > (1) read data

Re: [R] Naming output file

2024-06-24 Thread Fer Arce via R-help
Hi, try with: m<-3 for (im in 1:m) { mydata<-read.csv(paste0("2010midata",im,".csv")) assign(paste0("bop",im),boprobit(eqs,mydata,wt=weight,method="BHHH",tol=0,reltol=0,gradtol=1e-5, Fisher=TRUE) } cheers F. On 6/24/24 06:41, Steven Yen wrote: I would like a loop to (1) read data files 201

Re: [R] Integration of functions with a vector argument

2024-06-24 Thread Levine, Michael
Dear Bert, Thank you very much for your suggestions! Yours sincerely, Michael Michael Levine Associate Professor, Statistics Department of Statistics Purdue University 250 North University Street West Lafayette, IN 47907 USA email: mlev...@purdue.edu Phone: +1-765-496-7571 Fax: +1-765-494-05

Re: [R] Integration of functions with a vector argument

2024-06-24 Thread Levine, Michael
Dear Ivan, Thank you very much again for your suggestions! I will try to use Cubature, then. yours sincerely, Michael Michael Levine Associate Professor, Statistics Department of Statistics Purdue University 250 North University Street West Lafayette, IN 47907 USA email: mlev...@purdue.edu Ph

Re: [R] Naming output file

2024-06-24 Thread Steven Yen
Thanks to all. Editing the line to the following worked: ame<-ame.bopa(get(paste0("bop",im)),y1.level=y1value,y2.level=y2value,jindex=jindex1,vb.method="invH",joint12=TRUE,     printing=FALSE,testing=TRUE) On 6/24/2024 9:00 PM, Ivan Krylov wrote: В Mon, 24 Jun 2024 20:16:46 +0800 St

Re: [R] Naming output file

2024-06-24 Thread Ben Bolker
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

Re: [R] Naming output file

2024-06-24 Thread Ivan Krylov via R-help
В Mon, 24 Jun 2024 20:16:46 +0800 Steven Yen пишет: > 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, >   

Re: [R] Naming output file

2024-06-24 Thread Steven Yen
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",joint

Re: [R] Naming output file

2024-06-24 Thread Steven Yen
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 wrote: > > I would like a loop to > > (1) read

Re: [R] Naming output file

2024-06-24 Thread Rui Barradas
Às 12:41 de 24/06/2024, Steven Yen escreveu: 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, mydat

Re: [R] Naming output file

2024-06-24 Thread Eric Berger
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 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 wro

Re: [R] Naming output file

2024-06-24 Thread Ivan Krylov via R-help
В Mon, 24 Jun 2024 19:41:10 +0800 Steven Yen пишет: > (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 t

Re: [R] Naming output file

2024-06-24 Thread Eric Berger
How about assign(paste0("bop",im), boprobit( etc )) On Mon, Jun 24, 2024 at 2:41 PM Steven Yen 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.

[R] Naming output file

2024-06-24 Thread Steven Yen
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 ass