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(<whatever>, file = paste0("bop",im))
On Mon, 24 Jun 2024 at 23:41, 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 > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ 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.