gwidgets

R gWidgets embed a “rgl” 3D plot in gWidgets2 ggraphics device

醉酒当歌 提交于 2019-12-11 09:58:22
问题 Can I embed a "rgl" 3D plot in gWidgets2 ggraphics device? For example, library(gWidgets2) library(rgl) w <- gwindow("brushing example", visible=FALSE) g <- ggroup(cont=w) pg <- gnotebook(cont=g, expand=TRUE) dev1 <- ggraphics(cont=pg) visible(w) <- TRUE visible(dev1) <- TRUE plot.new() x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x,y) plot3d(x, y, z, col=rainbow(1000)) Can I put the 3D plot inside the gnotebook window? 来源: https://stackoverflow.com/questions/26558712/r

lattice graphics in a R widget

自闭症网瘾萝莉.ら 提交于 2019-12-11 05:38:10
问题 Using the gWidgets package I have made a R widget that shows a lattice graphic when the user click on a button. The function producing the graphic ( fgraph() below) runs well outside the widget. However the graphic at the topleft corner does not appear in the widget. Here is a reproducible code: library(lattice) sims <- data.frame( y=rnorm(8), A=factor(c(1,1,1,1,2,2,2,2)), B=factor(c(1,1,2,2,1,1,2,2)), C=factor(c(1,2,1,2,1,2,1,2)) ) fgraph <- function(sims){ plot( dotplot(y ~ A | B+C , data =

Loading and saving variables in R with gWidgets

廉价感情. 提交于 2019-12-06 07:56:16
For the past few months I've been building a simulation in R I hope to package. It consists of two usable functions, and many internal ones which one of the two usable functions call while looping, to perform the stages of simulation. A simple conceptual example is: # Abstract representation 1st Usable function, generates object containing settings for simulation. settings <- function(){ matrix(c(1:4),nrow=2,ncol=2) } # Abstract representation of one of many internal functions, does some action in simulation. int.func <- function(x){ out <- x*2 return(out) } # Abstract representation of second

R Prompt User With Autocomplete

北城以北 提交于 2019-12-04 12:03:27
Is there a way in R to prompt a user (i.e. scanf) for information and also allow auto-completion of that prompt using an array of strings as possible completions? Basically, looking for something like GNU Readline for R (ideally with an example). The autocomplete for function names, etc., seems to be a property of the development environment that is running R. So it works slightly differently in R GUI compared to eclipse compared to emacs compared to RStudio compared to whatever. From that, I think you may struggle to get autocomplete working in a portable way for scanf / readline without

gwidgets gtable refresh

ぃ、小莉子 提交于 2019-12-04 03:14:39
I encounter the following problem: library(gWidgets) options(guiToolkit = "RGtk2") aa <- c(1,2,3) bb <- c(4,5,6) cc <- cbind(aa,bb) cc <-as.data.frame(cc) t1 <- gtable(cc, container=TRUE) I want to refresh the content of t1 with: dd <- c(7,8,9) dd <- as.data.frame(dd) But when I run t1[] <- dd I receive: Can't replace with fewer columns Apostolos To expand upon John's answer, here's an example. #Data cc <- data.frame(aa = 1:3, bb = 4:6) dd <- data.frame(X = 7:9) #Wigdets win <- gwindow() grp <- ggroup(container = win) t1 <- gtable(cc, container = grp) #Refresh widget delete(grp, t1) t1 <-

How to return values from gWidgets and handlers?

爷,独闯天下 提交于 2019-12-03 12:45:34
问题 I am trying to develop a GUI (using gWidgets) for an R package. My plan was to construct a main window holding the data, and with buttons calling small gui wrappers for each function. Unfortunately I am stuck on a basic(?) problem - I don't know how to transfer the data. Questons: How to properly send data between separate windows? How to send data from within a handler in another window? My problem is similar to: Loading and saving variables in R with gWidgets, but from what I have read the

How to return values from gWidgets and handlers?

安稳与你 提交于 2019-12-03 03:08:29
I am trying to develop a GUI (using gWidgets) for an R package. My plan was to construct a main window holding the data, and with buttons calling small gui wrappers for each function. Unfortunately I am stuck on a basic(?) problem - I don't know how to transfer the data. Questons: How to properly send data between separate windows? How to send data from within a handler in another window? My problem is similar to: Loading and saving variables in R with gWidgets , but from what I have read the use of .GlobalEnv is not recommended. I have also seen someone using the <<- operator: http://www.mail

how can i change the shape mouse cursor in gWidgets RGtk2?

断了今生、忘了曾经 提交于 2019-12-01 22:29:57
In a Drawing Area of ggraphics in gWidgets changes the mouse cursor to "GDK_TCROSS",but i want the same mouse cursor of the gwindow "GDK_LEFT_PTR": library(gWidgets) library(gWidgetsRGtk2) library(RGtk2) options(guiToolkit = "RGtk2") w=gwindow("") g=ggraphics(cont=w,no_popup=T,do.rubber.banding = F) plot(x,y) c=gdkCursorNew("GDK_TOP_LEFT_ARROW") getToolkitWidget(g)$ModifyCursor(c) or gtkWidgetModifyCursor(getToolkitWidget(g),"GDK_TCROSS","GDK_LEFT_PTR") but this not works gtkWidgetModifyCursor modifies the colors of the cursor. You need to set the cursor through gdkWindowSetCursor . For that

data.table error when used through knitr, gWidgetsWWW

自作多情 提交于 2019-11-29 01:58:01
I'm experimenting with gWidgetsWWW and encountered a strange error. I created a button with a handler to knit2html a report which used the data.table assignment operator ":=". The report came back with this error: Error: := is defined for use in j only, and (currently) only once; i.e., DT[i,col:=1L] and DT[,newcol:=sum(colB),by=colA] are ok, but not DT[i,col]:=1L, not DT[i]$col:=1L and not DT[,{newcol1:=1L;newcol2:=2L}]. Please see help(":="). Check is.data.table(DT) is TRUE. The report generates as expected using knit2html directly and also through RStudio's "Knit HTML" button, so I'm unsure

data.table error when used through knitr, gWidgetsWWW

断了今生、忘了曾经 提交于 2019-11-27 16:29:09
问题 I'm experimenting with gWidgetsWWW and encountered a strange error. I created a button with a handler to knit2html a report which used the data.table assignment operator ":=". The report came back with this error: Error: := is defined for use in j only, and (currently) only once; i.e., DT[i,col:=1L] and DT[,newcol:=sum(colB),by=colA] are ok, but not DT[i,col]:=1L, not DT[i]$col:=1L and not DT[,{newcol1:=1L;newcol2:=2L}]. Please see help(":="). Check is.data.table(DT) is TRUE. The report