DT::datable manual column width adjustment with Shiny App - r

I would like to know if a DT::datatable output object's columns can be automatically adjusted inside a Shiny App? This seems like a very popular interface but I can't seem to do a simple manual column size adjustment, like the Rhandsontable, with the following call
hot_cols(manualColumnResize = TRUE)
If there is an option to do this via JavaScript I'll take that as well, as I've already search for how to do this with pure R syntax to no avail. Thanks.

Ok, I understand now, not from DT, but you could use {DataEditR} package instead.

Related

Table Column spacing in R tableHTML and mailr

I am trying to send a mail via mailr and it working fine. For sending a small table of 5 lines - I am using HTML format and it is working fine too.
I am using htmlTable package - the only disadvantage as of now is that I am not able to control the width of the column or the gap between the columns. Is there a possible way to control this.
I tried the kable and kableExtra package but the output is coming without any css formatting - a very plan HTML, however the Viewer in Rstudio is showing great but mail comes in without any formatting.
Even tried the formattable, it ok to somextent, but some CSS lookwise are getting removed in mailr - but is working for me, but lacks column size control here too.
Please advice on how to add column gaps/widths in htmlPackage or get the desired html formatting in mail using kable/kableExtra. or any knowledge sharing would be appreciated too.
You can use tableHTML for this (which is the package you tagged!!). As a small example, the argument widths controls the widths of the columns:
library(tableHTML)
mtcars[1:4, 1:5] %>%
tableHTML(widths = rep(100, 6))
You can pretty much add any kind of (other) CSS you want into the table by using the add_css_column function for columns (or any other add_css_ function for other parts of the table). There is a detailed explanation on the vignette.

Shiny: dataTableProxy - function doesn't exist?

I'm developing a Shiny application that provides interaction between a table with selection and a plot also with selection. When the plot is clicked to select a point, I would like to cascade that selection to the table. I've found this page (https://yihui.shinyapps.io/DT-proxy/) which describes exactly the process I'm trying to accomplish using dataTableProxy and selectRows functions. But even their example code does not work on my machine. I get an error saying "could not find function dataTableProxy"
I have version 0.1 of DT, shiny 0.12.2, shinydashboard 0.5.1, and R 3.1.2. Even looking at the DT documentation I see no mention of a dataTableProxy function.

Markdown syntax: problems with superscript

This is my first time using R so this is about as basic of a question as they come.
I am making a presentation using markdown (ioslides). I want to do something very simple which is to put something in superscript. According to the manual, the syntax is the following:
Lower bound = α^Full – K^ - α^Full^
The first time I tried running this, I got a pop-up screen with some options. Too quickly, I pressed enter and inadvertently chose something. Now the syntax won't run and I can't figure out what I did to undo it.
Can someone help? Thank you in advance.
Markdown allows HTML to be used if necessary, so you should be able to use the HTML sup tag.

R googleVis gvisMotionChart set colorvar to Unique Colours?

I am calling gvisMotionChart from the R package googleVis and I would like to set the colorvar parameter to "Unique colours". I tried colorvar="Unique colours" but it doesn't work for me.
I would also like to set it to select=All by default, although I am not sure if this option can be passed on right now.
Any ideas?
You should pass a list of options to gvisMotionChart command, like this
..., options=list(state='{"colorOption":"_UNIQUE_COLOR"};')
I don't know if there is an option for selecting all items. I usually select a couple of them, using iconKeySettings in the state definition, like this:
"iconKeySettings":[{"key":{"dim0":"actual"}},{"key":{"dim0":"baseline"}}]

Rstudio autocomplete variables

I am new to both R and Rstudio. I like the autocompletion of functions, models and data.frames. My question concerns autocompletion of variables.
So lets say I load the well known iris data.
I can start typing "ir", click click tab and get the rest of the dataset to autocomplete.
I also know can get the names of the variables by various means such as names(iris). Which I can copy and paste.
Now, how can I do a good autocomplete with variables? I would like to be able to type "pet" and tab and it gives me the different possible variables options to autocomplete (like it does for functions).
Is something like that possible?
The only workaround I can see is type out the full dataset$variable name such as iris$ then tab, when then allows me to select iris$petalwitdth. But that it more typing and makes for some ugly code. I just want "petalwidth" to autocomplete.
Options? Suggestions?
I think iris$P tab is preferable, but if you must, you can attach the dataset to the search path
attach(iris)
Then, P tab will auto complete

Resources