formattable

How to change appearance of table header row with R formattable package

馋奶兔 提交于 2019-12-22 09:48:01
问题 I'm using the formattable package in R to produce a HTML table. I can use formatter to customise the look of data values in in my table e.g. font-size, color etc. But I can't work out how to alter the appearance of the table header row.I can alter the actual column names using col.names(), but haven't been able to change their appearance. For example, in the table below how can I change the text color or background color in the header row (mpg, cyl, disp etc.) Ultimately, I plan to use

Hide HTML code inside datatable edit when formatting the table with formattable

僤鯓⒐⒋嵵緔 提交于 2019-12-13 18:05:08
问题 I'm using formattable and DT together in order to create a custom table, while still being able to edit the cell values (using editable=T , from DT ). The problem is that if I use formattable() to make a custom table, whenever I double click on a cell to edit its content, it will show the HTML code instead of the simple value. Here an example: library(formattable) library(DT) products <- data.frame(id = 1:5, price = c(10, 15, 12, 8, 9), rating = c(5, 4, 4, 3, 4), market_share = percent(c(0.1,

How to customize datatable by row with custom threshold

一个人想着一个人 提交于 2019-12-12 16:51:30
问题 This is related to this other question link. Currently I'm using this code in order to apply some styling to my table. I need to color each cell only if the value exceeds the 3rd quantile of the row , the problem is that DT doesn't seem to allow to work by row , just by column . formattable() works ok, but I lose some useful proprieties from DT , for example the possibility to edit the cell with editable=T . library(formattable) library(DT) dat <- as.data.frame(matrix(AirPassengers, ncol=12,

How to collapse groups of row values within a table using formattable?

冷暖自知 提交于 2019-12-12 13:02:17
问题 I am interested in using tools within the formattable R package, but I want to only shows in the table where there is a change. That is, I want hierarchical row labeling that is offered in the kableExtra package via the collapse_rows() function. For example, using kable() and kableExtra , I can do this: library(dplyr) library(knitr) library(kableExtra) iris %>% group_by(Species) %>% slice(1:2) %>% select(Species, everything()) %>% kable() %>% collapse_rows(1, valign="top") to produce this:

formattable package in Shiny R

╄→гoц情女王★ 提交于 2019-12-12 02:40:03
问题 I discovered recently the formattable package for R and I'm trying to use it on shiny but I didn't succeed. Here is the code I found on github: library(shiny) library(formattable) library(htmlwidgets) #This is the part that could be added to formattable to allow shiny integration. Not sure about height 100% but the function wont accept NULL formattableOutput <- function(outputId, width = "100%", height = "100%") { shinyWidgetOutput(outputId, "formattable_widget", width, height, package =

change header style formattable R

纵然是瞬间 提交于 2019-12-11 10:06:56
问题 I'm trying to use formattable with some values for species, thus, it's very important for column names to be italic; I've tried with the formatter() function, but it only acts on the values, even if I use the "th" node instead of "span" library(formattable) make_italic <- formatter("span", style = "font-style:italic") formattable(mtcars, list(mpg = make_italic, qsec = make_italic)) In the mtcars, how may I change the names (mpg, cyl, disp,...) to italic? 回答1: I don't know the formattable

Filtering dataframes with formattable

家住魔仙堡 提交于 2019-12-10 09:16:04
问题 Sample Data (amended from formattable github docs): df <- data.frame( id = 1:10, name = c("Bob", "Ashley", "James", "David", "Jenny", "Hans", "Leo", "John", "Emily", "Lee"), age = c(48, 47, 40, 28, 29, 29, 27, 27, 31, 30), test1_score = c(18.9, 19.5, 19.6, 12.9, 11.1, 7.3, 4.3, 3.9, 2.5, 1.6), test2_score = c(9.1, 9.1, 9.2, 11.1, 13.9, 14.5, 19.2, 19.3, 19.1, 18.8), stringsAsFactors = FALSE) You can make a pretty table with extra color formatting like this: library(formattable) formattable(df

Powershell Loop through Format-Table

送分小仙女□ 提交于 2019-12-08 00:52:20
问题 I've got a question. I've created a format-table with filename, source- and destination directory. Now I try to loop through the table with a foreach. Inside this loop i want to move the files from the source- to destination directory. My problem is to get the items from the row. Here is my example code: cls $MovePathSource = "C:\Users\user\Desktop\sourcefolder" $MovePathDestination = "C:\Users\user\Desktop\destinationfolder" $filetypes = @("*.llla" , "html") $table = dir $MovePathSource

Formattable based on multiple columns

时光总嘲笑我的痴心妄想 提交于 2019-12-06 08:54:49
问题 I am using the package formattable to generate a formatted table. I found a nice resource Formatting tables in R. But here the example of arrow formatting is based only on the specific column. My requirement is: Say I have from different cities, column A and B, where A has factors with two levels 'Number of Trees' and 'Pollution', while B is the percentage change of these YoY. So I want to format the Column B with a positive green arrow if there has an increase for Column A values being

How to change default output Formatting of Powershell to use Format-Table -autosize?

依然范特西╮ 提交于 2019-12-06 06:49:53
问题 How can I enforce powershell to use Format-Table -auto as a default formatting when writing a returned array of objects to the console? Thanks 回答1: If you are OK calling the cmdlet every time and if you have at least PowerShell v3.0 then you can set a $PSDefaultParameterValues which you can read more about at about_Parameters_Default_Values. The syntax that would satisfy your need would be: $PSDefaultParameterValues=@{"<CmdletName>:<ParameterName>"="<DefaultValue>"} So we add in the switch by