[R] cat in a subroutine

Steven T. Yen @tyen @end|ng |rom ntu@edu@tw
Thu Oct 13 11:02:55 CEST 2022


Not really.

fortytwo<-42
cat("\nMarginal and Discrete Effects of Gen Ordered Logit / Probit 
Probabilities",
     "logisitic =",fortytwo,"\n")

 > goprobit1.r.me.kr<-me.gologit.r(goprobit1,embellished=TRUE,
+                                 resampling=TRUE,ndraws=5); 
goprobit1.r.me.kr
Error in cat("\nMarginal and Discrete Effects of Gen Ordered Logit / 
Probit Probabilities",  :
   unused arguments (fortytwo, "\n")

On 10/13/2022 4:46 PM, Jim Lemon wrote:
> Hi Steven & Erin,
> This works:
>
> fortytwo<-42
> cat("\nMarginal and Discrete Effects of Gen Ordered Logit / Probit
> Probabilities","logisitic =",fortytwo,"\n")
> j<-grep(".one\\b",c(".one\\a",".one\\b"))
>
> Marginal and Discrete Effects of Gen Ordered Logit / Probit
> Probabilities logisitic = 42
>
> If I don't define fortytwo before calling cat, it doesn't.
> So we know what the answer is.
>
> Jim
>
> On Thu, Oct 13, 2022 at 7:36 PM Steven Yen <styen using ntu.edu.tw> wrote:
>> t<-abs(me)/se; p<-2*(1-pt(t,nrow(x)))
>> sig<-my.sig.levels(p)
>> out<-data.frame(round(cbind(me,se,t,p),digits)); out<-cbind(out,sig)
>> rownames(out)<-names(me)
>> colnames(out)<-c("est","se","t","p","sig")
>> cat("\nMarginal and Discrete Effects of Gen Ordered Logit / Probit
>> Probabilities",
>>       "\n\nlogistic =",logistic)
>> j<-grep(".one\\b",rownames(out))
>> out<-out[-j,]
>> return(out)
>> }
>>
>> Steven from iPhone
>>
>>> On Oct 13, 2022, at 3:37 PM, Erin Hodgess <erinm.hodgess using gmail.com> wrote:
>>>
>>> t<-abs(me)/se; p<-2*(1-pt(t,nrow(x)))
>>> sig<-my.sig.levels(p)
>>> out<-data.frame(round(cbind(me,se,t,p),digits)); out<-cbind(out,sig)
>>> rownames(out)<-names(me)
>>> colnames(out)<-c("est","se","t","p","sig")
>>> cat("\nMarginal and Discrete Effects of Gen Ordered Logit / Probit
>>> Probabilities",
>>>       "\n\nlogistic =",logistic)
>>> j<-grep(".one\\b",rownames(out))
>>> out<-out[-j,]
>>> return(out)
>>> }
>>          [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using 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.



More information about the R-help mailing list