Ultimate goal: Display gt table in pop-out window with 3 buttons to control script action
Minimum goal: Display a gt table in pop-out viewer window
Full detail:
I am creating a table using the gt package in R. I want to display the table with three options for how to proceed: OK (script continues), Edit (allow the user to make minor modifications to a specific column), Cancel (something has gone wrong and the process needs to be terminated). My plan is to allow a quick QC of the data before it gets saved. My issue is that I have no idea how to display a gt table in a viewer window or with tk_messageBox and that's about the only package I know of that might do this.
Any ideas?
Here's an example gt table:
table <- gt(mtcars) %>%
tab_header(
title = md("**2014 - 2019 Salary and Playoff Appearances**⚽"),
subtitle = "I am a boss")
you could achieve such an effect with shiny/miniUI specifically runGadget()
see this answer I gave yesterday which is an example where the user is shown two checkboxes to interact with that are returned as data into the calling environment
Is it possible to create a check box to record a user's input without resorting to Shiny in R?
Related
Hi I would like to make a plot of the sequence of modal states (seqmsplot in TraMineR) but because I am making a figure which consists some other plots I would like to remove the in-build subtitle which says "Modal state sequence ..." because this is affecting the heights of y-axis. Does anyone know how I can remove this in seqmsplot and use main="Modal state sequence" instead?
Below is a picture (from TraMineR website) which shows which part I would like to remove.
Up to TraMineR v 2.2-2, the display of the info about the frequency of the sequence of modal states was hard coded.
The development version 2.3-3 (available on R-Forge), which will eventually become 2.2-3 on the CRAN, offers a new attribute info in the plot method plot.stslist.modst invoked by seqmsplot.
With this new version, you can suppress the info with seqmsplot(..., info=FALSE). For example, using the mvad data:
data(mvad)
m.seq <- seqdef(mvad[,17:86], xtstep=3)
seqmsplot(m.seq, info=FALSE)
Trying to use gvisTimeline from googleVis, but I'd like the plots to be shown in the Viewer Pane.
From what I can gauge from here (http://www.r-bloggers.com/display-googlevis-charts-within-rstudio/) it looks like the Viewer pane should be the default, but mine is showing up in the browser.
I did find this support article (https://support.rstudio.com/hc/en-us/articles/202133558-Extending-RStudio-with-the-Viewer-Pane) but am unclear how to apply it to my specific need of using gvisTimeline.
ex:
library(googleVis)
dat <- data.frame(Stn=device.positions$StationName,Idnt=device.positions$Ident,start=as.POSIXct(device.positions$Start),end=as.POSIXct(device.positions$End))
timeline <- gvisTimeline(data=dat, rowlabel="Stn", barlabel="Idnt", start="start", end="end")
plot(timeline)
where device.positions is a basic data table
When you plot the googleViz object you need to pass this as an option
plot(object, browser=rstudio::viewer)
When using the command View(matrix) or View(dataframe) or by doubleclicking in Rstudio on the Data in the global environment, a screen shows up in which you can see your data. However, when scrolling down on that screen the column names dissappear. Is there a "freeze panes" option as in excel?
Thanks
I find gvisTable from package googleVis quite convenient when viewing data in RStudio.
"The gvisTable function reads a data.frame and creates text output referring to the Google Visualisation API, which can be included into a web page, or as a stand-alone page. The actual chart is rendered by the web browser."
gvisTable opens a viewer pane in RStudio (where local web content can be viewed). The headers are always visible and there are several options that allow you to customize the view. You can sort by variables by clicking on their header.
A simple example:
library(googleVis)
gt <- gvisTable(iris)
plot(gt)
gt <- gvisTable(iris, options = list(page = 'enable', height = 200))
plot(gt)
I generate an excel file using the great PHPExcel library. At this moment I need to show all the columns into a single page. You know the feeling when you have to scroll left and right up and down to see all the data. Basically I have 33 columns and I need to fit them on any display
I don't know if is my setup or where is the problem, but I can't make it work. This is the code I'm using
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
On MS Excel I select all thw colums then I choose View-> Zoom, then select Fit Selection. How can I do that programatically when excel file is generated with PHPExcel.
i hope i don't understand you wrong, here it goes:
phpExcel has an method called setZoomScalezoom(), however this does not auto fill the whole screen:
example:
$excel = new PHPExcel();
$sheet = $excel->getActiveSheet();
$sheet->getSheetView()->setZoomScale(300);
$writer = new PHPExcel_Writer_Excel5($excel);
$writer->save('test.xls');
got my information from:
source: http://typo3.org/extension-manuals/phpexcel_library/1.7.4/view/5/4/
Setting worksheet zoom level To set a worksheet’s zoom level, the
following code can be used:
$objPHPExcel->getActiveSheet()->getSheetView()->setZoomScale(75);
Note that zoom level should be in range 10 – 400.
Built a summary table, but the labels of the row groups are not showing up.
args(data)
summary1 <- list("Gender"= list("Female"
=~qwraps2::n_perc0(Sex==0, na_rm=TRUE))
table1 <- summary_table(data, summary1)
My table looks like this: table1:
How do I get the "Gender" group name to show-up in the table?
It looks like you are viewing the table in RStuido via double clicking on the table1 in the "Environment" tab. The display is as expected. The structure of the qwraps2_summary_table object is a character matrix. In or outside of RStudio you can get the same result shown in the question post via View(table1).
To see the well rendered html you'll need to knit a .Rmd to html. Or, in RStuido you can upon a "R Notebook." A screen capture of of a simple example from an R Notebook follows:
This may be related to how you "show" your table (You did not write anything about how you got it). When I use qwraps in rmarkdown in edit mode. When I just select the table (in your case table1) and press ctrl + enter I get the result you're asking for. If I use kable(table1) this removes this labelling.
I think the print() function recognized the qwrap table and prints it with the group names.
Ask a minimally reproducible example if you want more help.