Re: [R] How to catch value

From: Kristel Joossens <kristel.joossens_at_econ.kuleuven.ac.be>
Date: Sat 03 Dec 2005 - 21:13:36 EST

You can have a look at
https://stat.ethz.ch/pipermail/r-help/2005-November/082060.html

There are at least 2 ways to solve your problem First, you can also make use of the assign function I refer here to R> ?assign

After editting par assing the value of par to the variable name "par" by par<-edit(par)
assign("par",par, envir = .GlobalEnv)

Secondly, similar to assign, you can also use <<- I refer here to R> help("<<-")
par<<-edit

Good luck,
Kristel

Chun-Ying Lee wrote:
> Dear R users:
> I have a problem about catch the value from function.
> I have following two functions (part):
> fbolus1 <- function()
> {.........
> par<-data.frame(Parameter=c("kel","Vd"),Initial=c(0))
> check(par)
> .....}
> check<-function(par)
> {
> if (par[ ,2] <= 0){
> cat("\nEnter again (y/n) ?\n\n")
> ans<-readline()
> if (ans == "n" ){
> return(tidy.up())
> }
> else{
> cat("\n")
> par<-edit(par)
> }
> }
> }
>
> I wonder if it is possible to catch the value ("par" in this example) which
> "check" function generated and than go back to the "fbolus1" function, and
> keep executing the command next to "check(par)", and "fbolus1" function can
> accept the value "check" function generated. If it is possible, please give me
> some comments. Thanks in advance !!
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Dec 03 21:18:15 2005

This archive was generated by hypermail 2.1.8 : Sat 03 Dec 2005 - 23:32:15 EST