I have a markdown document I'm processing with the pandoc tool to generate HTML and PDF documents. I'm trying to include a table in the document. Regular markdown doesn't support tables, but pandoc does. I've tried copy-pasting the definition of a table from the pandoc documentation into my source document, but when running it through the pandoc program the resulting document is all crammed into one big table.
Can anyone show me a pandoc table that renders properly?
# Points about Tweedledee and Tweedledum
Much has been made of the curious features of
Tweedledee and Tweedledum. We propose here to
set some of the controversy to rest and to uproot
all of the more outlandish claims.
. Tweedledee Tweedledum
-------- -------------- ----------------
Age 14 14
Height 3'2" 3'2"
Politics Conservative Conservative
Religion "New Age" Syrian Orthodox
--------- -------------- ----------------
Table: T.-T. Data
# Mussolini's role in my downfall
--------------------------------------------------------------------
*Drugs* *Alcohol* *Tobacco*
---------- ------------- ----------------- --------------------
Monday 3 Xanax 2 pints 3 cigars,
1 hr at hookah bar
Tuesday 14 Adderall 1 Boone's Farm, 1 packet Drum
2 Thunderbird
Wednesday 2 aspirin Tall glass water (can't remember)
---------------------------------------------------------------------
Table: *Tableau des vices*, deluxe edition
# Points about the facts
In recent years, more and more attention has been
paid to opinion, less and less to what were formerly
called the cold, hard facts. In a spirit of traditionalism,
we propose to reverse the trend. Here are some of our results.
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
---------------------------------------
Table: Crucial Statistics
# Recent innovations (1): False presentation
Some, moved by opinion and an irrational lust for novelty,
would introduce a non-factual element into the data,
perhaps moving all the facts to the left:
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
---------------------------------------
Table: Crucial "Statistics"
# Recent innovations (2): Illegitimate decoration
Others, preferring their facts to be *varnished*,
as we might say, will tend to 'label' the columns
Variable Before During After
--------- ------ ---------- -------
12 12 12 12
123 123 123 123
1000 1000 1000 1000
----------------------------------------
# Recent innovations (3): "Moderate" decoration
Or, maybe, to accompany this 'spin' with a centered or centrist representation:
Variable Before During After
---------- ------- ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
-----------------------------------------
# The real enemy
Some even accompany these representations with a bit of leftwing
clap-trap, suggesting the facts have drifted right:
------------------------------------------------------
Variable Before During After
---------- ----------- ---------- -------
12 12 12 12
-- Due to
baleful
bourgeois
influence
123 123 123 123
-- Thanks
to the
renegade
Kautsky
1 1 1 1
-- All a
matter of
sound Party
discipline
-------------------------------------------------------
Table: *"The conditions are not ripe, comrades; they are **overripe**!"*
# The Truth
If comment be needed, let it be thus: the facts have drifted left.
------------------------------------------------------------------------
Variable Before During After
---------- ------------- ---------- ----------------------
12 12 12 12
(here's (due to (something to do
where the rot lapse of with Clinton and
set in ) traditional maybe the '60's)
values)
123 123 123 123
(too much (A=440?)
strong drink)
1 1 1 1
(Trilateral Commission?)
--------------------------------------------------------------------------
Table: *The Decline of Western Civilization*
Related
I have this excel table used as a DB named "csv" :
Ticket agent_wait client_wait
1 200 105
2 10 50
3 172 324
I'd like to calculate the average of the ratios of the agent wait. ration_agent being calculated as agent_wait / (agent_wait + client_wait).
If the table were like this:
Ticket agent_wait client_wait ratio_agent
1 200 105 0.65
2 10 50 0.16
3 172 324 0.24
I'd just do the average of the ratio_agent column with =AVERAGE(csv[ratio_agent]).
The problem is that this last column does not exist and I don't want to create an additional column just for this calculation.
Is there a way to do this with only a formula ?
I already tried
=AVERAGE(csv[agent_wait]/(csv[agent_wait]+csv[client_wait])) but it gives me the answer for only one line.
You can use the formula you have used, but you need to enter it as an array formula. What this means is, after entering the formula, do not press Enter, but hold Ctrl+Shift and then press Enter. The resulting formula will turn into this after you do that:
{=AVERAGE(csv[agent_wait]/(csv[agent_wait]+csv[client_wait]))}
And give your the value you are looking for. Use the correct columns (first csv[agent_want] to csv[client_wait]) if you are looking for the average client_wait instead.
It has come to me that your question might be an XY problem. Please take a read on this answer. It might help you decide on what you are actually looking for.
In brief if you want a measure of how much time:
agents spend waiting, out of all the waiting between agents and clients, calculate the totals first and get the average of these totals. Outliers e.g. a special case where an agent spent lots more time on a client than the client themselves will heavily affect this measure. Use this measure if you want to know how much time agents spend waiting when opposed to how much clients wait.
=SUM(csv(agent_wait)/sum(csv[agent_wait]+csv[client_wait]))
agents each spend waiting on any particular call, calculate the ratios first then the average of these. Outliers will not affect this measure by much and give an expected ratio of time an agent might spend on any interaction with a client. Use this measure if you want to have a guideline as to how much an agent should spend waiting for each unit of time a client spends waiting.
=AVERAGE(csv[agent_wait]/(csv[agent_wait]+csv[client_wait]))
It also wouldn't be correct to do the =AVERAGE(csv[ration_agent]) calculation. An average of the average isn't the overall average. You need to sum the parts and then compute the overall average using those parts.
Ticket | agent_wait | client_wait | ratio_agent
------ | ---------- | ----------- | -----------
1 | 200 | 105 | 0.656
2 | 10 | 50 | 0.167
3 | 172 | 324 | 0.347
Total | 382 | 479 | ?????
The question is what goes in for the ?????.
If you take the average of the ratio_agent column (i.e. =AVERAGE(Table1[ratio_agent])) then you get 0.390.
But if you compute the ratio again, but with the column totals, like =csv[[#Totals],[agent_wait]]/(csv[[#Totals],[agent_wait]]+csv[[#Totals],[client_wait]]), then you get the true answer: 0.444.
To see how this is true try this set of data:
Ticket | agent_wait | client_wait | ratio_agent
------ | ---------- | ----------- | -----------
1 | 2000 | 2000 | 0.500
2 | 10 | 1 | 0.909
Total | 2010 | 2001 |
The average of the two ratios is 0.705, but it should be clear that if the total agent wait was 2010 and the total client wait was 2001 then the true average ratio must be closer to 0.500.
Computing it using the correct calculation you get 0.501.
after years of quietly learning from this site I've finally hit a question who's answer I cannot seem to find on StackOverflow...
I have a pivot table that needs to calculate Net Promoter Score from several groups within a population.
Net promoter score is calculated like so:
[% of Population that give 9 or 10/10] - [% of Population that give 1 to 6/10]
Each individual record in my source data can only have a single Score of between 1 and 10:
RAW DATA:
Date (dd/mm) Country Type Score (1-10) NPS Category
01/05 US Order enq. 9 Promoter
13/05 US Check-out 5 Detractor
28/05 US Order enq. 7 Passive
So, with help from the answers below I've added a column to categorise each individual into the Promoter (9 or 10), Passive (7 or 8) and Detractor (1 to 6) groups based on that score: screenshot of raw data (with sensitive items hidden).
All that remains now is:
How can I create a calculated 'NPS' column like the one shown in my (rudimentary) representation of a pivot table below that takes the Detractor value from the Promoter value?
D = Detractor group
Pa = Passive group
Pr = Promoter group
| Order enquiry | Check-out |
| D Pa Pr NPS | D Pa Pr NPS |
-------------------------------------------------- |
GB | | |
May | 0 0 100 100 | 30 20 50 20 |
Jun | 10 30 60 50 | 35 35 60 25 |
Jul | 30 20 50 20 | 40 10 40 0 |
US | | |
May | 45 15 40 - 5 | 50 10 40 -10 |
Jun | 40 30 30 -10 | 40 30 30 -10 |
Jul | 5 35 60 55 | 20 40 40 20 |
My attempt at a calculated column can be seen in this screenshot. This results in an error and of course I haven't managed to convert the NPS counts into percentages yet.
It would be my suggestion to create a new column in the source that calculates D, Pa,Pr by a formula.
You can now create the % for these values in the pivot. The NPS column can either be calculated after pivoting the output field, or by creating a pivot-column formula in Excel.
It's not clear from your question how your data is laid out, or what exactly you're asking. From what I can see, you need to add a column in your raw data table, which says something like
=COUNTIFS(UniqueID,MyUniqueID,Score,">=9")-COUNTIFS(UniqueID,MyUniqueID,Score,"<=6")
Then another column that says
=IF(NetPromoter>=9,"Pr",IF(NetPromoter>=7,"Pa","D"))
And then in your pivot table you add the Classification as a new subcolumn, and add the NPS as the Average of your NPS column, or something like that.
Please show your data if you want the formulas changed to meet your actual range/variable terms.
I am using tabstat in Stata, and using estpost and esttab to get its output to LaTeX. I have
tabstat
to display statistics by group. For example,
tabstat assets, by(industry) missing statistics(count mean sd p25 p50 p75)
The question I have is whether there is a way for tabstat (or other Stata commands) to display the output ordered by the value of the mean, so that those categories that have higher means will be on top. By default, Stata displays by alphabetical order of industry when I use tabstat.
tabstat does not offer such a hook, but there is an approach to problems like this that is general and quite easy to understand.
You don't provide a reproducible example, so we need one:
. sysuse auto, clear
(1978 Automobile Data)
. gen Make = word(make, 1)
. tab Make if foreign
Make | Freq. Percent Cum.
------------+-----------------------------------
Audi | 2 9.09 9.09
BMW | 1 4.55 13.64
Datsun | 4 18.18 31.82
Fiat | 1 4.55 36.36
Honda | 2 9.09 45.45
Mazda | 1 4.55 50.00
Peugeot | 1 4.55 54.55
Renault | 1 4.55 59.09
Subaru | 1 4.55 63.64
Toyota | 3 13.64 77.27
VW | 4 18.18 95.45
Volvo | 1 4.55 100.00
------------+-----------------------------------
Total | 22 100.00
Make here is like your variable industry: it is a string variable, so in tables Stata will tend to show it in alphabetical (alphanumeric) order.
The work-around has several easy steps, some optional.
Calculate a variable on which you want to sort. egen is often useful here.
. egen mean_mpg = mean(mpg), by(Make)
Map those values to a variable with distinct integer values. As two groups could have the same mean (or other summary statistic), make sure you break ties on the original string variable.
. egen group = group(mean_mpg Make)
This variable is created to have value 1 for the group with the lowest mean (or other summary statistic), 2 for the next lowest, and so forth. If the opposite order is desired, as in this question, flip the grouping variable around.
. replace group = -group
(74 real changes made)
There is a problem with this new variable: the values of the original string variable, here Make, are nowhere to be seen. labmask (to be installed from the Stata Journal website after search labmask) is a helper here. We use the values of the original string variable as the value labels of the new variable. (The idea is that the value labels become the "mask" that the integer variable wears.)
. labmask group, values(Make)
Optionally, work at the variable label of the new integer variable.
. label var group "Make"
Now we can tabulate using the categories of the new variable.
. tabstat mpg if foreign, s(mean) by(group) format(%2.1f)
Summary for variables: mpg
by categories of: group (Make)
group | mean
--------+----------
Subaru | 35.0
Mazda | 30.0
VW | 28.5
Honda | 26.5
Renault | 26.0
Datsun | 25.8
BMW | 25.0
Toyota | 22.3
Fiat | 21.0
Audi | 20.0
Volvo | 17.0
Peugeot | 14.0
--------+----------
Total | 24.8
-------------------
Note: other strategies are sometimes better or as good here.
If you collapse your data to a new dataset, you can then sort it as you please.
graph bar and graph dot are good at displaying summary statistics over groups, and the sort order can be tuned directly.
UPDATE 3 and 5 October 2021 A new helper command myaxis from SSC and the Stata Journal (see [paper here) condenses the example here with tabstat:
* set up data example
sysuse auto, clear
gen Make = word(make, 1)
* sort order variable and tabulation
myaxis Make2 = Make, sort(mean mpg) descending
tabstat mpg if foreign, s(mean) by(Make2) format(%2.1f)
I would look at the egenmore package on SSC. You can get that package by typing in Stata ssc install egenmore. In particular, I would look at the entry for axis() in the helpfile of egenmore. That contains an example that does exactly what you want.
I am doing my final year dissertation research and I just gathered all the results from my questionnaire, from which I got 210 responses.
I am really struggling with Excel here, so I hope somebody can help me with this.
I am running Mac Office 2011. I have a single file which is so composed:
You are a... | You like... | Gender
participant 1 Carrot | blu, red | male
participant 2 Pear | blu | female
participant 3 Carrot | red | female
I was able to create a Pivot table of how "you are a...", like so:
Carrot | 2
Pear | 1
Total | 3
I was also able to convert this total in percentage, by right clicking in the cell and selecting
Field settings > options > Show data as > % of total.
(by the way, there is a way to add another column with percentages next to the original numbers)
Anyway, my issues are the following:
1) how can I see ho many carrots and pears replied to the gender? Something like
Male | Female | Total
Carrot 1 | 1 | 2
Pear 0 | 1 | 1
Total 1 | 2 | 3
2) Also, how many participants liked blue given that the field is single and contains all the values?
ps. all the data is already consistent as apart from a few fields, questions were multiple choice selection
Thank you very much for those who will help!
I'm implementing a DNS(multicast DNS in fact) in c#.
I just want to know if I must encode my uint/int/ushort/... with the LSB on the left or the MSB on the left. And more globally how I could know this? One of this is standard?
Because I didn't found anything in the IETF description. I found a lot of things(each header field length, position), but I didn't found this.
Thank you!
The answer is in RFC 1035 (2.3.2. Data Transmission Order)
Here is the link: http://www.ietf.org/rfc/rfc1035.txt
And the interesting part
2.3.2. Data Transmission Order
The order of transmission of the header and data described in this
document is resolved to the octet level. Whenever a diagram shows a
group of octets, the order of transmission of those octets is the
normal order in which they are read in English. For example, in the
following diagram, the octets are transmitted in the order they are
numbered.
0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 1 | 2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 3 | 4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 5 | 6 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Whenever an octet represents a numeric quantity, the left most bit in
the diagram is the high order or most significant bit. That is, the
bit labeled 0 is the most significant bit. For example, the following
diagram represents the value 170 (decimal).
0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
|1 0 1 0 1 0 1 0|
+-+-+-+-+-+-+-+-+
Similarly, whenever a multi-octet field represents a numeric quantity
the left most bit of the whole field is the most significant bit.
When a multi-octet quantity is transmitted the most significant octet
is transmitted first.