用于R应用程序的日期选择器。

时间:2022-03-04 23:05:23

I am searching for a simple date picker to use with R. I can find many pickers written in other languages, but I would rather not mix languages if at all possible. Does anyone know of a R package which provides this functionality?

我正在寻找一个简单的日期选择器来使用r。有人知道R包提供了这个功能吗?

2 个解决方案

#1


4  

If you don't mind installing gWidgets and gWidgetstcltk you have this:

如果您不介意安装gWidgets和gWidgetstcltk,您有:

library(gWidgetstcltk)
options(guiToolkit="tcltk")
#    
pickDate <- function() {
  date <- NULL
  dlg <- gbasicdialog(handler=function(...) date <<- svalue(calendar))
  calendar <- gcalendar(cont=dlg)
  visible(dlg, set=TRUE)
  date
}

#2


0  

i think you can use gcalendar() from gWidgets.

我认为您可以从gWidgets中使用gcalendar()。

options("guiToolkit"="RGtk2")
library(RGtk2)
library(gWidgets)

win <- gwindow("Test Calendar", width=12)   
Group <- ggroup(cont=win)

tmp <- gframe("Date", container=Group )
add(tmp, calStart)
add(tmp, calEnd)

calStart <- gcalendar("Debut", format = "%Y-%m-%d")
calEnd <- gcalendar("Fin", format = "%Y-%m-%d")

dateStart <- svalue(calStart) 
dateFin <- svalue(calEnd)

Perhaps, this can help you.

也许,这能帮助你。

Regards,

问候,

YougyZ

YougyZ

#1


4  

If you don't mind installing gWidgets and gWidgetstcltk you have this:

如果您不介意安装gWidgets和gWidgetstcltk,您有:

library(gWidgetstcltk)
options(guiToolkit="tcltk")
#    
pickDate <- function() {
  date <- NULL
  dlg <- gbasicdialog(handler=function(...) date <<- svalue(calendar))
  calendar <- gcalendar(cont=dlg)
  visible(dlg, set=TRUE)
  date
}

#2


0  

i think you can use gcalendar() from gWidgets.

我认为您可以从gWidgets中使用gcalendar()。

options("guiToolkit"="RGtk2")
library(RGtk2)
library(gWidgets)

win <- gwindow("Test Calendar", width=12)   
Group <- ggroup(cont=win)

tmp <- gframe("Date", container=Group )
add(tmp, calStart)
add(tmp, calEnd)

calStart <- gcalendar("Debut", format = "%Y-%m-%d")
calEnd <- gcalendar("Fin", format = "%Y-%m-%d")

dateStart <- svalue(calStart) 
dateFin <- svalue(calEnd)

Perhaps, this can help you.

也许,这能帮助你。

Regards,

问候,

YougyZ

YougyZ