How to control formatting of pipe format tables in bookdown, such as striping? - rstudio

Many thanks to Rstudio for the visual Rmarkdown editor. I am using it to generate and preview bookdown content. When I insert a table, it generates a pipe format table. However I want to remove the alternate row shading which kable does by default. There is plenty of documentation on using function kable_styling but I cannot use that - there is no object for the table, it is autogenerated in the visual editor. I don't really want to load it into a dataframe - that seems the wrong route.
How can I switch off row shading for pipe format tables globally or more generally modify the options for tables generated in this way via the visual Rmarkdown editor or otherwise?
A minimal section of my table looks like this. When I knit it in Rstudio as a Rmarkdown document it appears unstriped. I would like it stripe-free in bookdown, and ideally to control other styling of it.
+------------------+------------+
| $A=\pi.r^2$ | 1 |
+------------------+------------+
| $\sqrt{b^2-4ac}$ | 2 |
+------------------+------------+
| $\sum{1/i}$ | 3 |
+------------------+------------+
Many thanks.

Related

Laravel 5.4 - Saving Excel data into dynamically created columns in MySQL

I have a internal webpage that makes data from excel searchable and readable from a 3rd party excel export file. The webpage allows for the uploading of multiple excel files in which the data gets read and stored in a MySQL database.
We want to update the application to keep a history of the uploaded data (it's data that has monthly values) so we can easily search, filter and generate graphs from the uploaded data.
So I am using Laravel 5.4 and have maatwebsite\excel to import and parse the excel file.
The Excel file always consists of the following columns (Dummy File)
| Item group | item # | item name | Item Currency | <month> <year> |
After Item Currency there is always 36 columns for the past 3 years of data from the current month so a column would be named like dec 2017
Now in Laravel I have created a Model for the item named Item and a model for the monthly values named ItemMonthly
Now I am able to read the file and create columns dynamically in the database but I feel like this is very ugly and not efficient at all:
(Gist) Code for Models and Excel Function
Biggest problem
Because I need to read all the monthly data and since I need them in order of month I can't really rename all the columns as far as I know. I need to be able to get all the columns to render in a Highchart graph and in a Datatable. and some items don't have the same monthly data (some only go till 2015 for example.
Needed advice
I've read a couple of solutions here some of them saying instead of creating columns in MySQL just store the monthly data as a json object in a single column.
Some answers just completely advice on changing from MySQL to MongoDB
I am kind of at a loss to find the best approach for this, and am sincerely wondering if MySQL is the right way to go. The solutions I have been trying so far all seem to involve really hacky ways of doing this.
If there is more info needed please let me know. I don't want to write an immense wall of text but I also want to provide the correct amount of information.
Many thanks!

How do I display database data in table format?

I want to display the table in the below format. How can I achieve this?
---A----+-----B-----+----C-----
12335 | abcd | qwerty
45335 | efgh | poiuy
78956 | hjukukuk | mkloijhkll
12346 | sfsfsf | vbhkhadad
EDIT 1:
The contents of the table can be of any length. The width of the particular cell has to be decided by the content itself.
I got the column width from
col_width = a.transpose.map{|col| col.map{|cell| cell.to_s.length}.max}
and displayed the table contents with:
a.each{|row| puts '['+
row.zip(col_width).map{|cell, w| cell.to_s.ljust(w)}.join(' | ')+']'}
where 'a' contains the data from the database.
I only cannot get to print the column headers.
How i can achieve those so that it can align with the table cell contents.
I need to display the output in the console. I am using OCI for accessing the database.
The Sequel ORM can do this using the pretty_table extension. Otherwise HIRB is capable of doing it, either with ActiveRecord, or from arrays/hashes.
I use Sequel often, and have occasional need to display a table summary on the console, so pretty_table works nicely for me.
HIRB is used in the irbtools plugin for IRB, and provides table output for all sorts of things.
In either case, the displayed table width is dynamically determined using the lengths of the strings being displayed to find the widths of the columns. I've never tried pushing really long strings through either that would require wrapping inside a column, but they should automatically handle that since it's a common requirement.
I wrote a gem that will help you with this: http://github.com/arches/table_print

csv-table formatting through preamble?

Try as I might, I cannot figure out how to change the default table format in the pdf output from sphinx.
I could edit the .tex file, or the writer.py source code... but both of those seem like bad options.
Is there any thing that can be passed to the preamble to accomplish that?
Depending on what you are trying to accomplish by changing the table format. For instance if you want to define row colors and change the tables accordingly across the document you can use both the xcolor package and redefine how tabular handles that at the point of definition by changing the tabular environment.
So in the preamble you would do
\usepackage[table]{xcolor}
\definecolor{foo}{RGB}{236,137,29}
\definecolor{bar}{RGB}{232,108,31}
\let\newtabular\tabular
\let\newendtabular\endtabular
\renewenvironment{tabular}{\rowcolors{2}{foo}{bar}\newtabular}{\newendtabular}
This will overwrite the default tabular environment and apply the foo and bar row colors throughout the document, starting at the second row.
For having more directives related to tables. You should take a look at sphinxtr
Jeff Terrace has some great extensions included, but the two main ones to use are numfig and figtable. You can wrap a csv table into figtable.
.. figtable::
:label: my-csv-label
:caption: My CSV Table
:nofig:
.. csv-table::
:file: data/foo.csv
:header-rows: 1
Changing the standard table format with the caption below instead of above. Then you also have the added benefit of being able to directly link to that table by using :num:.
:num:`Table #my-csv-label`
It will automatically number accordingly, without referencing the label name. You can also use
.. figtable::
:spec: {r l r l}
To better define how you want your table to appear.

Wicket custom (data)table layout

Is there a way to customize the wicket DataTable layout?
I'd like to have a DataTable with a horizontal flow of data and multiple columns per row.
e.g.:
------------------------------
|prename| John| surname| Doe |
------------------------------
|city | NY | country| USA |
------------------------------
Unlike the normal use of the DataTable class this would be used for displaying just one object (respectively one dataset)
Don't use a DataTable for this.
For a simple case, just make a panel containing a Label for each data element and put the table layout in the corresponding html fragment.
To make it more dynamic, with parametrized size as noted in your comment, you might build your own structure using nested RepeatingView components, one for the rows and one for the columns, or perhaps use a DataGridView, which would do some of the layout work for you.
But DataTable is really meant for a table with meaningful columnar structure and includes alot of code for handling the column structure which won't make sense for your data and will get in your way.

How to see the full name of a field in TFS

I am trying to setup a config file to work with my TFS Fields and I am having problems finding the full name of a field.
For example, In the query view I just see Delivery Order, but I know that it's full name is Conchango.TeamSystem.Scrum.DeliveryOrder.
Anyidea how I can see that value for all the fields on my Work Items?
If you install the TFS Power Tool you will get the process template editor. If you open the Work Item that you want to see the fields for in there you will get a list of all the fields.
Figure: Select "Tools | Process Editor | Work Item Types | Open WIT from Server"
Figure: Connect to the correct TFS server and select a project
Figure: You can see the list of fields
It is worth noting that the Label used on the Work Item Form may be diferent from the actual name of the field.

Resources