[R] tkfocus issue
Dear All: I am stuck with this issue: I have a button on a TK window, once click it, it pops up a individual plot device: individual_plot <- function() { tkconfigure(overlay.button, state="normal") options(locatorBell = FALSE) plotfuntype() trellis.focus("panel", 1, 1,highlight=FALSE) panel.identify(labels=colnames(dataplot)) } Now I have another button, originally state="disabled", but activated by : tkconfigure(overlay.button, state="normal") in previous function: The overlay function was writen to overlay another plot to the original plot. --The problem: 1.once the plot device is out, I can't go back to the Tk window, it is take hostage by the plot image some how. As a result, overlay button won't work. 2. Is there a mechanism to detect close/destroy of the plotting device in R? I want to use that even to make overlay.button state to "disabled" so user won't be able to click overlay just to get an error message if there is no plot already exist... Thanks Hao __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] overlay boxplot
hi, All: I need to overlay two boxplot, I played around with points() but found it does not seem to work with boxplot, it works fine with other. Is there a way to overlay two boxplot (using different color) in R? There was a thread talking about using ggplot package, however, I don't think there is a final solution... the answer give does not give overlay but a new plot. Thanks Hao __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] overlay boxplot
Thanks... I just realized using add=TRUE will work... Best Hao hadley wickham wrote: > You will get more useful answers if you specify exactly how you want > to overlay the boxplots (overlay them on what?). You can certainly do > this with the ggplot2 package, or lattice or base graphics. > > Hadley > > On 7/10/07, Hao Liu <[EMAIL PROTECTED]> wrote: > >> hi, All: >> >> I need to overlay two boxplot, I played around with points() but found >> it does not seem to work with boxplot, it works fine with other. Is >> there a way to overlay two boxplot (using different color) in R? >> >> There was a thread talking about using ggplot package, however, I don't >> think there is a final solution... the answer give does not give overlay >> but a new plot. >> >> Thanks >> Hao >> >> __ >> 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 >> and provide commented, minimal, self-contained, reproducible code. >> __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] focus to tkwindow after a PDF window pop up
Thanks... I finally used BrowseURL(), which is how Rcmdr does this... it starts firefox and things are ok... Thanks Hao Peter Dalgaard wrote: > Hao Liu wrote: > >> Dear All: >> >> I currently have a TK window start a acroread window: However, when >> the acroread window is open, I can't get back to the TK window unless >> I close the acroead. >> >> I invoked the acroread window using: system(paste("acroread ",file, >> sep="")) >> >> anything I can do to make them both available to users? >> > > Tell system() not to _wait_ for command to complete. > __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] focus to tkwindow after a PDF window pop up
Dear All: I currently have a TK window start a acroread window: However, when the acroread window is open, I can't get back to the TK window unless I close the acroead. I invoked the acroread window using: system(paste("acroread ",file, sep="")) anything I can do to make them both available to users? Thanks Hao __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] checking for "viability" of a GUI component
Dear All: The question: How do I check for existance of the GUI, instead of checking the variable of the GUI? I created a log window for several applications, they will check for the existance of log window, if it exists, append output to it, otherwise, create log window and insert to it. What I found out is that if I close the X window of the GUI, the variable logwin still exists, confuse arises to other components that are supposed to use the GUI. create.log.win <- function(inputtext){ if(exists(is.null("logwin"))) {return} else { logwin <<- tktoplevel() logtext <<- tktext(logwin, bg="white") tkwm.title(logwin," Log Window") loglabel <- tklabel(logwin, text="Logging Analaysis Information") tkgrid(loglabel) tkgrid(logtext) if (is.matrix(inputtext)) { for (i in 1:nrow(inputtext)) tkinsert(logtext, "end",paste(paste(inputtext[i,],collapse=" "),"\n",sep="")) } else tkinsert(logtext, "end",paste(inputtext,"\n",sep="")) export_button <- tkbutton(logwin, text = "Export Log", command=savelog) tkgrid(export_button) } } -- I understand I should bind a function to remove the varialbe with a close button, however, we can't stop users from closing window just by clicking on the upper right corner. How do I check for existance of the GUI, instead of the variable? Thanks __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] GUI component Margin on tkcanvas, tkframe or tktoplevel
Dear gurus: I have a question on how to configure the margin layout on tcl/tk GUI objects like tkcanvas, tkframe or tktoplevel. For example, if I want to leave a larger margin on the left side of the GUI container, which one should I configure, the toplevel or tkcanvas or tkframe? top<-tktoplevel() canvas<-tkcanvas(top, relief=, borderwidth=...) I also find the documentation for all the possible arguments that could be passed to tktoplevel, tkframe, tkcanvas, tk.wm, tkconfigure is not good. I wonder if there are good resource for it... at the very least, I know I need to look at what arguments that tck/tk takes... but I don't have time to go that far. Thanks Hao __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to repress the annoying complains from X window system
Thanks for the input, however, I am using R 2.4.0. I don't know how the SysAdmin installed or configured it though. I am not running Rcmdr, I am developing R GUI applications using Tcl/Tk package, for some weird reason, those messages comes and goes... Thanks Hao Marc Schwartz wrote: >On Fri, 2007-05-18 at 11:25 -0400, Hao Liu wrote: > > >>Dear All: >> >>I am running some GUI functions in linux environment, they runs fine, >>however I constantly get this kind of message in R console: >> >>Warning: X11 protocol error: BadWindow (invalid Window parameter) >> >>Is there a way to repress it? Or am I doing something wrong here.. it >>does not interfere with the running of fucntion though. >> >>Thanks >>Hao >> >> > >Upgrade your version of R. > >You have not provided sufficient details, but if I had to guess, you are >either running RCmdr or using other tcl/tk based widgets. > >If correct, the error message that you are seeing was fixed back in R >2.4.0: > >o The X11() device no longer produces (apparently spurious) > 'BadWindow (invalid Window parameter)' warnings when run from > Rcmdr. > >HTH, > >Marc Schwartz > > > > [[alternative HTML version deleted]] __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] How to repress the annoying complains from X window system
Dear All: I am running some GUI functions in linux environment, they runs fine, however I constantly get this kind of message in R console: Warning: X11 protocol error: BadWindow (invalid Window parameter) Is there a way to repress it? Or am I doing something wrong here.. it does not interfere with the running of fucntion though. Thanks Hao __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is it possible to pass a Tcl/Tk component as argument to afunction
John: Thanks for your reply, I spent some time on this and the conclusion is it works: top<- tktoplevel() mainFrame <- tkcanvas(top) both top and mainFrame can be used as parameters to pass to other function. The name, however, will conflict each other if they are defined in the same environment, which means if you have another top and mainFrame passed to another function, the GUIs will get to the same container. To avaoid this, better use different name. I wonder if there is a way for me to create an env and eliminate an env dynamically, I will try to get some information, but I definitely welcome some quick inputs... Thanks Hao John Fox wrote: >Dear Hao, > >You might take a look at how the Rcmdr package is implemented with many >reusable elements. There is, for example, an initializeDialog function. > >I hope this helps, > John > > >John Fox, Professor >Department of Sociology >McMaster University >Hamilton, Ontario >Canada L8S 4M4 >905-525-9140x23604 >http://socserv.mcmaster.ca/jfox > > > > >>-Original Message----- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On Behalf Of Hao Liu >>Sent: Wednesday, May 16, 2007 8:58 AM >>To: r-help@stat.math.ethz.ch >>Subject: [R] Is it possible to pass a Tcl/Tk component as >>argument to afunction >> >>hi! All: >> >>I wonder if someone has done this before... >> >>I am writing several functions that conduct statistical >>analysis using a GUI interface by Tcl/Tk, they share many >>identical GUI components. What I am trying to do now is to >>simplify the code by writing a GUI repository for all the >>components they use, thus save effort for code maintenance. >> >>Since they all use: >> >>mainFrame <- tkcanvas(top) >> >>-- >> >>I wonder if I can write functions that take mainFrame as an >>argument, and call those functions from other place with >>initialized tkcanvas object. I did not see example like this >>and from my *limited* experience with tcltk, I found it >>always need something to be initialized before put to use, >>that makes me wonder if this idea will work... if it does >>not, any work arounds? like using Macro? >> >>Thanks >>Hao >> >> [[alternative HTML version deleted]] >> >>__ >>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 >>and provide commented, minimal, self-contained, reproducible code. >> >> >> > > > > [[alternative HTML version deleted]] __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Is it possible to pass a Tcl/Tk component as argument to a function
hi! All: I wonder if someone has done this before... I am writing several functions that conduct statistical analysis using a GUI interface by Tcl/Tk, they share many identical GUI components. What I am trying to do now is to simplify the code by writing a GUI repository for all the components they use, thus save effort for code maintenance. Since they all use: mainFrame <- tkcanvas(top) -- I wonder if I can write functions that take mainFrame as an argument, and call those functions from other place with initialized tkcanvas object. I did not see example like this and from my *limited* experience with tcltk, I found it always need something to be initialized before put to use, that makes me wonder if this idea will work... if it does not, any work arounds? like using Macro? Thanks Hao [[alternative HTML version deleted]] __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] keyboard issue in R console
hi! All: I can do up or down arrow on keyboard to browse through command history on R console in windows. However, I can't do that on a linux xterm or console... I wonder how to make this feature work on linux... it will make working a lot more efficient... Thanks Hao __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] R GUI programming
Hi, All: I am having a problem with handling global variable value in GUI programming, I hope R gurus can give me some advice on it. What I want to do is to read in a dataset, display some information based on the input and do some calculation on the dataset: However, I am having trouble organizing my code, as the following code goes, the comboBox section will have to be put in the loaddataset function, otherwise, since comboBox is displayed upon GUI initialization, later changes to the .dataset won't be reflected in the display. -- dataset.header <- tclVar("header information") .dataset <- 0 loaddataset <- function(.dataset) { # this function is bind to a tkbutton file <- tclvalue(tkgetOpenFile()) if (!length(file)) return() tclvalue(dataset.file)<-file .dataset <- read.csv(file,header=TRUE) # read in .CSV file to R object cat(colnames(.dataset)) tclvalue(dataset.header) <- colnames(.dataset) cat(paste("after assign: ", tclvalue(dataset.header), sep="")) tclvalue(output.dir) <- tclfile.dir(file) tkmessageBox(title="Setting Output Directory", message=paste("Setting output directory to ", tclvalue(output.dir), sep=" "), icon="info", type="ok") #cat(paste("\"The column names are: ", colnames(dataset), "\"\n", sep="")) #cat(paste("\n the dimension is: ", dim(.dataset), "\n", sep="")) #headers <- paste("\"", colnames(.dataset), "\"", sep="") # parameters derived from input data dataset.label <- tklabel(boxplotcanvas, text="Select variable from dataset: ", font=font1) comboBox <- tkwidget(boxplotcanvas,"ComboBox",editable=FALSE,values=tclvalue(dataset.header)) tkgrid(dataset.label, comboBox) tkgrid.configure(dataset.label, sticky="w") tkgrid.configure(comboBox, sticky="e") } --- The same situation for if I want to plot the readin dataset, since I want to bind the plot function to a tkbutton, I still have not find a way to pass the readin .dataset over to the plot function. Thanks Hao __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with parsing multiple coxph() results
Thanks, I can do calculatation for each gene, however what I want to do is to fit the model on each and every gene, store their result and then be able to access all of them, then filter on them, to do that: 1. I need to know how to access each part of the coxph result, like its coefficient, exp(coef),P,Z, etc. 2. I need to be able to generate a graphical presentation of the filtered genes, to show how their expression level is associated with survival, etc. I just could not find any explanation as to how to check different part of a coxph result, not to mention to store them in certain data structure, like vectors Java or Perl, etc. Best Hao -Original Message- From: Fredrik Lundgren [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 17, 2006 2:26 PM To: Hao Liu Cc: R-help Subject: Re: [R] help with parsing multiple coxph() results Hao, I'm not sure but you have specified your modell as tautology. The formula below should be enough: survtest <- coxph(Surv(fup_interval, endpoint) ~ geneid, data = pcc.primary.stg.3.cox) HTH Fredrik - Original Message - From: "Hao Liu" <[EMAIL PROTECTED]> To: Sent: Tuesday, January 17, 2006 7:47 PM Subject: [R] help with parsing multiple coxph() results > Dear All: > > I have a question on using coxph for multiple genes: > > I have written code to loop through all 22283 genes in the Hgu-133A > and > apply coxph on survival data. > > However, I don't know how to work with the result for each gene: > > survtest<-coxph(Surv(pcc.primary.stg.3.cox[,'fup_interval'],pcc.primary.stg. > 3.cox[,'endpoint'])~pcc.primary.stg.3.cox[,'geneid'],pcc.primary.stg.3.cox) > > each time I tried to look at what is in survtest it gives me this: > > > == > coxph(formula = Surv(pcc.primary.stg.3.cox[, "fup_interval"], >pcc.primary.stg.3.cox[, "endpoint"]) ~ pcc.primary.stg.3.cox[, >"208181_at"], data = pcc.primary.stg.3.cox) > > > coef exp(coef) se(coef) z > p > pcc.primary.stg.3.cox[, "208181_at"] -1.87 0.1540.688 -2.72 > 0.0065 > > Likelihood ratio test=8.56 on 1 df, p=0.00343 n= 48 > > === > > What I wanted to do is to use a matrix to store each "survtest" > result, but > it seems to me there is no data > structure in R to store the result of coxph into a matrix. I got the > following code to calculate a P value > based on "survtest" > = > z<-survtest$coefficients/sqrt(surv$var) > p<-2*(1-pnorm(abs(z))) > > then, what is the P value thus calculated? > === > The question I have are: > > 1. How do I access different parts of coxph result? > 2. Is there a way to store multiple coxph results into a data > structure that > can be efficiently accessed? > 3. if I find a list of genes I am interested, are there efficient to > plot > all of them based on the survial data? > > Thanks > Hao Liu, Ph. D > > > > [[alternative HTML version deleted]] > > __ > 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 > __ 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
[R] help with parsing multiple coxph() results
Thanks for your reply, but I am not sure if I understand your reply right: are you saying the "geneid" in your post is a vector of all 22283 genes? I want to do cox fit to each and everyone of the 22283 genes and need a way to summarize it -- to do that, I need to know how to parse the result for each coxph result. Thanks Hao [[alternative HTML version deleted]] __ 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
[R] help with coxph() for multiple genes
Dear All: I have a question on using coxph for multiple genes: I have written code to loop through all 22283 genes in the Hgu-133A and apply coxph on survival data. However, I don't know how to work with the result for each gene: survtest<-coxph(Surv(pcc.primary.stg.3.cox[,'fup_interval'],pcc.primary.stg. 3.cox[,'endpoint'])~pcc.primary.stg.3.cox[,'geneid'],pcc.primary.stg.3.cox) each time I tried to look at what is in survtest it gives me this: == coxph(formula = Surv(pcc.primary.stg.3.cox[, "fup_interval"], pcc.primary.stg.3.cox[, "endpoint"]) ~ pcc.primary.stg.3.cox[, "208181_at"], data = pcc.primary.stg.3.cox) coef exp(coef) se(coef) z p pcc.primary.stg.3.cox[, "208181_at"] -1.87 0.1540.688 -2.72 0.0065 Likelihood ratio test=8.56 on 1 df, p=0.00343 n= 48 === What I wanted to do is to use a matrix to store each "survtest" result, but it seems to me there is no data structure in R to store the result of coxph into a matrix. I got the following code to calculate a P value based on "survtest" = z<-survtest$coefficients/sqrt(surv$var) p<-2*(1-pnorm(abs(z))) then, what is the P value thus calculated? === The question I have are: 1. How do I access different parts of coxph result? 2. Is there a way to store multiple coxph results into a data structure that can be efficiently accessed? 3. if I find a list of genes I am interested, are there efficient to plot all of them based on the survial data? Thanks Hao Liu, Ph. D [[alternative HTML version deleted]] __ 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
[R] help with parsing multiple coxph() results
Dear All: I have a question on using coxph for multiple genes: I have written code to loop through all 22283 genes in the Hgu-133A and apply coxph on survival data. However, I don't know how to work with the result for each gene: survtest<-coxph(Surv(pcc.primary.stg.3.cox[,'fup_interval'],pcc.primary.stg. 3.cox[,'endpoint'])~pcc.primary.stg.3.cox[,'geneid'],pcc.primary.stg.3.cox) each time I tried to look at what is in survtest it gives me this: == coxph(formula = Surv(pcc.primary.stg.3.cox[, "fup_interval"], pcc.primary.stg.3.cox[, "endpoint"]) ~ pcc.primary.stg.3.cox[, "208181_at"], data = pcc.primary.stg.3.cox) coef exp(coef) se(coef) z p pcc.primary.stg.3.cox[, "208181_at"] -1.87 0.1540.688 -2.72 0.0065 Likelihood ratio test=8.56 on 1 df, p=0.00343 n= 48 === What I wanted to do is to use a matrix to store each "survtest" result, but it seems to me there is no data structure in R to store the result of coxph into a matrix. I got the following code to calculate a P value based on "survtest" = z<-survtest$coefficients/sqrt(surv$var) p<-2*(1-pnorm(abs(z))) then, what is the P value thus calculated? === The question I have are: 1. How do I access different parts of coxph result? 2. Is there a way to store multiple coxph results into a data structure that can be efficiently accessed? 3. if I find a list of genes I am interested, are there efficient to plot all of them based on the survial data? Thanks Hao Liu, Ph. D [[alternative HTML version deleted]] __ 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