# [R] cat in a subroutine

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu Oct 13 10:46:12 CEST 2022

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